Mike Orr wrote:
> I had some trouble today returning a static file from a controller
> action.  I think this could be made easier by a class method on
> webob.Response that sets the headers for the file (MIME type,
> caching), and can be returned instead of the regular response.
> 
> Alternatively, a method in the base controller could configure the
> global response, but that would be controller-specific whereas the
> WebOb method could be used in any context.

I showed how to do this right in a WebOb tutorial 
(http://pythonpaste.org/webob/file-example.html), and while it's not 
terribly hard it's not so easy that it feels like it really belongs in a 
method.  I've thought about writing a small static file package (also 
replacing StaticURLParser and PkgResourcesParser) but haven't gotten 
around that that.

> Supposedly you can return a WSGI application from an action, but i
> couldn't get it to work with paste.fileapp.

Figuring that out would be the best way to go.  I thought you had to 
call it, like "return app(request.environ, self.start_response)", but 
I'm not sure; returning the app would certainly look nicer.

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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-devel" 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-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to