mirror of https://github.com/mitsuhiko/flask.git
Browse Source
This allows adding error handlers like this: @app.errorhandler(werkzeug.exceptions.Forbidden) And subclassing HTTPExceptions: class ForbiddenBecauseReason(Forbidden): pass @app.errorhandler(ForbiddenBecauseReason) def error1(): return "Forbidden because reason", 403 @app.errorhandler(403) def error2(): return "Forbidden", 403 ... the idea being, that a flask extension might want to raise an exception, with the default behaviour of creating a HTTP error page, but still allowing the user to add a view/handler specific to that exception (e.g., "Forbidden because you are not in the right group").pull/839/head
Daniel Richman
12 years ago
3 changed files with 49 additions and 3 deletions
Loading…
Reference in new issue