Catch and re-raise HTTPRedirections.
from webob.exc import HTTPRedirection
try:
stuff()
except HTTPRedirection:
raise
except e: # other exceptions
handle_error(e)
.pk.
HTTPFound (302) is a subclass of HTTPRedirect (300-399), which in turn
is a subclass of HTTPException (100-599). So the "proper" thing to do
is to catch and re-raise HTTPException.
This is not very intuitive or documented. I never encountered it
because I call redirect() and abort() only in the actions themselves.
I can't think of any way to improve it without changing the paradigm,
and exceptions are uniquely suited to this task of jumping back
through the call stack to some unknown handler. So I guess we'll just
have to put a note in the manual.
--
Mike Orr <slugg...@gmail.com>
I must have caught it in my code - once or twice ;-)
.pk.