[FIX] base: ir.http: only server_attachement for 404 errors

fixes #6792
This commit is contained in:
Christophe Simonis 2015-05-21 13:46:38 +02:00
parent 1cf5723835
commit 8a430c4a23
1 changed files with 4 additions and 3 deletions

View File

@ -137,9 +137,10 @@ class ir_http(osv.AbstractModel):
def _handle_exception(self, exception):
# This is done first as the attachment path may
# not match any HTTP controller.
attach = self._serve_attachment()
if attach:
return attach
if isinstance(exception, werkzeug.exceptions.HTTPException) and exception.code == 404:
attach = self._serve_attachment()
if attach:
return attach
# If handle_exception returns something different than None, it will be used as a response
try: