Philip Jenvey wrote:
> Paste provides a WSGI application (paste.fileapp.FileApp) for serving  
> file downloads. Take a look at your pylons project's default error  
> controller for an example of how to use it, in the img/style actions.

All the other discussion aside, this is really the best way to implement 
this.  FileApp has several useful features, like respecting the 
conditional headers, setting Content-Length, etc.  It would look like:

class MyController(BaseController):
     def index(self):
         # ... auth stuff, or whatever...
         wsgi_app = FileApp('/path/to/file')
         return wsgi_app(req.environ, req.start_response)


Should req have a method like req.delegate(any_wsgi_app)?  Also, perhaps 
it would look for a .wsgi_application argument, so you could do:

exc = httpexceptions.HTTPRedirect(headers=[('location', loc)])
return req.delegate(exc)

Anyway, that's an aside; you should use FileApp regardless.


-- 
Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to