On 22 July 2010 20:01, Mike Orr <[email protected]> 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.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. The original proposal works like a charm in Pylons 0.9.6.2 - maybe there were some incompatible changes in a later version, which make it impossible to still use it that way?
But I will keep that in mind, if I need anything like that in one of our newer pylons apps. Jens -- 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.
