On Fri, 2011-06-03 at 02:51 -0500, Michael Merickel wrote:
> +1 to the "raise abort(..)" or "raise redirect(..)" options.
> 
> I'm torn on the ability to raise arbitrary Response objects.
> Also I'm curious about what the deal is with conditional responses...
> I'm not very familiar with them but I get curious when I hear that
> Pyramid can't handle something!

The issue is with how Pyramid uses (or really more how it doesn't use
parts of) webob.Response.

Currently view callables that don't use a renderer are obligated to
return an object with this interface:

class IResponse(Interface):
    status = Attribute('WSGI status code of response')
    headerlist = Attribute('List of response headers')
    app_iter = Attribute('Iterable representing the response body')

That is, the only restriction that Pyramid puts upon view callable code
is that it must return an object with those three attributes.  Pyramid
doesn't care if that object is a webob.Response object.  Indeed Pyramid
internally uses IResponse objects that implement this interface that do
not inherit from webob.Response (NotFound and Forbidden currently).

In the meantime, the conditional response code within WebOb is only
executed when a webob.Response object is treated as a WSGI application
(its __call__ is called with an "environ" and a "start_response").
Pyramid never uses a webob response object as a WSGI application,
however; it's __call__ is never called.  This means that its
conditional response code is ignored.  This is that code:
https://bitbucket.org/ianb/webob/src/411997824d3b/webob/response.py#cl-942 .

This isn't ideal.

- C




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

Reply via email to