durusmail: quixote-users: PublishError exception handling overhaul
PublishError exception handling overhaul
2002-05-14
2002-05-14
2002-05-14
2002-05-14
PublishError exception handling overhaul
Titus Brown
2002-05-14
-> > This mechanism would allow redirects after exceptions, correct?
->
-> Yes, will continue to work.  We use:
->
->     class NotLoggedInError(AccessError):
->         def __str__ (self):
->             request = get_request()
->             request.redirect("/user/login?%s" %
url_quote(request.get_path()))
->             request.response.set_header("Content-Type", "text/plain")
->             return AccessError.__str__(self) # usually not seen

Gawd, I didn't even think of that (I'm not using redirects for errors
at the moment).   I'm not sure using redirects in a __str__ function
is what I'd want to do, though ;).

-> PublishError exceptions cause the normal path traversal and call
-> sequence to be interrupted.  The exception handler can return any kind
-> of page it wants.

So, if you have _q_exception(), wouldn't that then be able to explicitly
return a redirect (the way _q_index can, for example)?  That seems like
a nicely distributed way of handling these things...

--titus


reply