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
Neil Schemenauer
2002-05-14
On Tue, May 14, 2002 at 07:01:53AM -0700, Titus Brown wrote:
> 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

Then, in _q_access we do:

    raise NotLoggedInError("You must sign in before doing XYZ")

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

  Neil


reply