Skip to content
Snippets Groups Projects
Commit a7aa8537 authored by Olivier Dony's avatar Olivier Dony
Browse files

[FIX] website: exception handling: let redirects pass untouched

The website module normally tries to render user-friendly
error pages for any error occurring during the processing
of a website-enabled request.
This happens even for werkzeug's HTTPExceptions that have
their own response, because we want the website layout to
be applied on top of the error page.

One special sort of HTTPException should be preserved
without rewriting: the manually-crafted ones generated
with abort(), and usually wrapping a redirect response,
which bears no alteration.
parent 7e9dfa77
No related branches found
No related tags found
No related merge requests found
......@@ -127,6 +127,11 @@ class ir_http(orm.AbstractModel):
if isinstance(exception.qweb.get('cause'), openerp.exceptions.AccessError):
code = 403
if isinstance(exception, werkzeug.exceptions.HTTPException) and code is None:
# Hand-crafted HTTPException likely coming from abort(),
# usually for a redirect response -> return it directly
return exception
if code == 500:
logger.error("500 Internal Server Error:\n\n%s", values['traceback'])
if 'qweb_exception' in values:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment