Re: Returning a file object from an action

2010-07-23 Thread Mike Orr
On Fri, Jul 23, 2010 at 4:52 AM, Jens Hoffrichter wrote: > On 22 July 2010 20:01, Mike Orr wrote: > I think you want something like this. > > from paste.fileapp import FileApp > > # in controller >     #...in some action, get the path to serve >    

Re: Returning a file object from an action

2010-07-23 Thread Jens Hoffrichter
On 22 July 2010 20:01, Mike Orr wrote: >>> > I think you want something like this. >>> > >>> > from paste.fileapp import FileApp >>> > >>> > # in controller >>> >     #...in some action, get the path to serve >>> >     wsgi_app = FileApp(path) >>> >     return wsgi_app(request

Re: Returning a file object from an action

2010-07-22 Thread Mike Orr
On Thu, Jul 22, 2010 at 1:40 AM, Marius Gedminas wrote: > On Wed, Jul 21, 2010 at 12:40:23PM -0700, Mike Orr wrote: >> On Wed, Jul 21, 2010 at 12:33 PM, Ian Wilson >> wrote: >> > Hello, >> > >> > I think you want something like this. >> > >> > from paste.fileapp import FileApp >> > >> > # in

Re: Returning a file object from an action

2010-07-22 Thread Mengu
serving files are all about http headers. On Jul 22, 11:40 am, Marius Gedminas wrote: > On Wed, Jul 21, 2010 at 12:40:23PM -0700, Mike Orr wrote: > > On Wed, Jul 21, 2010 at 12:33 PM, Ian Wilson > > wrote: > > > Hello, > > > > I think you want something like this. > > > > from paste.fileapp imp

Re: Returning a file object from an action

2010-07-22 Thread Marius Gedminas
On Wed, Jul 21, 2010 at 12:40:23PM -0700, Mike Orr wrote: > On Wed, Jul 21, 2010 at 12:33 PM, Ian Wilson > wrote: > > Hello, > > > > I think you want something like this. > > > > from paste.fileapp import FileApp > > > > # in controller > >     #...in some action, get the path to ser

Re: Returning a file object from an action

2010-07-21 Thread Mike Orr
On Wed, Jul 21, 2010 at 1:03 PM, Jens Hoffrichter wrote: > Hi, > > On 21 July 2010 21:40, Mike Orr wrote: >> On Wed, Jul 21, 2010 at 12:33 PM, Ian Wilson >> wrote: >>> Hello, >>> >>> I think you want something like this. >>> >>> from paste.fileapp import FileApp >>> >>> # in controller

Re: Returning a file object from an action

2010-07-21 Thread Jens Hoffrichter
Hi, On 21 July 2010 21:40, Mike Orr wrote: > On Wed, Jul 21, 2010 at 12:33 PM, Ian Wilson > wrote: >> Hello, >> >> I think you want something like this. >> >> from paste.fileapp import FileApp >> >> # in controller >>     #...in some action, get the path to serve >>     wsgi_ap

Re: Returning a file object from an action

2010-07-21 Thread Wichert Akkerman
On 2010-7-21 21:40, Mike Orr wrote: On Wed, Jul 21, 2010 at 12:33 PM, Ian Wilson wrote: Hello, I think you want something like this. from paste.fileapp import FileApp # in controller #...in some action, get the path to serve wsgi_app = FileApp(path) return

Re: Returning a file object from an action

2010-07-21 Thread Mike Orr
On Wed, Jul 21, 2010 at 12:33 PM, Ian Wilson wrote: > Hello, > > I think you want something like this. > > from paste.fileapp import FileApp > > # in controller >     #...in some action, get the path to serve >     wsgi_app = FileApp(path) >     return wsgi_app(request.environ

Re: Returning a file object from an action

2010-07-21 Thread Ian Wilson
Hello, I think you want something like this. from paste.fileapp import FileApp # in controller #...in some action, get the path to serve wsgi_app = FileApp(path) return wsgi_app(request.environ, self.start_response) A better solution you might want to look into

Returning a file object from an action

2010-07-21 Thread Jens Hoffrichter
Hi everyone, I looked into the documentation, but couldn't find any mentioning of what I could return from an action. I know that I can return a string, most likely rendered from a template. Is it possible to return a file object from an action, so that the contents of the file will be delivered