On Thu, Jul 22, 2010 at 1:40 AM, Marius Gedminas <[email protected]> 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 <[email protected]> 
>> 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, self.start_response)
>>
>> Yes, use paste.fileapp.  You can just return the wsgi_app object
>> directly, and Pylons will call it for you.
>
> Don't you also need to wrap it in pylons.controllers.util.forward?
>
> http://pylonshq.com/docs/en/0.9.7/modules/controllers_util/#pylons.controllers.util.forward
>
> (I haven't tried simply returning FileApp() myself, but I have memories
> of someone on IRC who tried and got scant success.)

    def bnb(self):
        app = FileApp("/home/mso/data/images/bnb.gif")
        return app

TypeError: 'FileApp' object is not iterable

I guess you can't. I must be remembering wrong.

In any case, forward() is a wrapper that extracts the environ and
start_response for you and calls the app.

-- 
Mike Orr <[email protected]>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to