On Tue, May 31, 2011 at 12:55 PM, Chris McDonough <chr...@plope.com> wrote:
> - We will disuse the classes from webob.exc because, although they
>  advertise themselves as Response objects, they really very badly
>  want to be used as WSGI applications rather than "plain response"
>  objects.

Aren't all Response objects WSGI applications? I thought that was part
of the API, that they could serialize themselves.

> - "pyramid.response.Response" will now be a *subclass* of
>  webob.response.Response (rather than an alias) which will
>  both inherit from Exception (so it can be raised) and will provide
>  the pyramid.interfaces.IExceptionResponse interface.

Can't anything be raised regardless of whether it inherits from
Exception? (And for new-style classes, if the Python version is recent
enough.) I think Pylons' abort() raises HTTPException subclasses,
doesn't it?

So I don't see how these new exception classes will be different from
the old ones except for a new parent and interface, which doesn't
really affect the user.

> After the above steps are taken, "raise
> pyramid.response.HTTPUnauthorized(...)" from within view code (or
> event handler code) will generate a 401 response code with a default
> body out-of-the-box.  It will mean (probably more controversially)
> "raise Response('OK')" will generate a 200 response code with the body
> "OK".

It may be an unorthodox way to return but it's probably better to just
allow it than to take steps to prevent it. I could see how it could be
a "feature" in a few cases.  And again, Python doesn't seem to be
overly concerned with what you raise. The move against string
exceptions was to make sure you provided the actual class in the
'except' clause rather than comparing by equality.

-- 
Mike Orr <sluggos...@gmail.com>

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