If a view raises an exception, say a custom ValidationError class, then that ValidationError object is set as request.exception when the exception view is called (if you have registered a matching custom exception view).
On the other hand if a security policy denies access (returning a Denied object) then the forbidden view (again: if you've registered one) gets called with an HTTPForbidden object as request.exception. Is there a nice way to attach a custom error object to the forbidden view? For example by replacing the HTTPForbidden with a custom exception class, or by attaching an exception or dict to the HTTPForbidden? The Denied object that the security policy returned is available to the forbidden view as request.exception.result. The Denied class's only attribute is a msg string. But I suppose the security policy could just attach a custom attribute to the Denied object? Or would you implement a custom subclass of Denied? That's what ACLSecurityPolicy seems to do. Thanks! -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/bcf4aa9c-205d-4dc1-a684-20fa1f59a889%40www.fastmail.com.
