I've created a branch named "httpexception-utils" on GitHub which
contains an implementation of "redirect" and "abort" for Pyramid that
act like their Pylons brethren.

In short, the abort feature is used like this:

    from pryamid.httpexceptions import abort

    def aview(request):
        abort(401)

This will perform the same job as what used to be necessary as:

    def aview(request):
        return HTTPUnauthorized()

The redirect feature is used like this:

    from pryamid.httpexceptions import redirect

    def aview(request):
        redirect('http://example.com')

This will perform the same job as what used to be necessary as:

    def aview(request):
        return HTTPFound(location='http://example.com')

In addition, any "HTTP exception" (an exception imported from
pyramid.httpexceptions) can now be raised rather than returned.  The
object raised will be used as a response.

Here's the branch:

https://github.com/Pylons/pyramid/tree/httpexception-utils

Here's the commit which added the feature:

https://github.com/Pylons/pyramid/commit/1ffb8e3cc21603b29ccd78152f82cca7f61a09b1

It'd be nice to get some feedback from existing Pylons users to see if
the implementations of these features are "good enough"; it'd also be
nice to hear dissenting opinions with reasons for dissent if folks
believe this feature should not be added to Pyramid.

- 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