From 8a430c4a238912b45e3c4d805bb78a1131dd7612 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 21 May 2015 13:46:38 +0200 Subject: [PATCH] [FIX] base: ir.http: only server_attachement for 404 errors fixes #6792 --- openerp/addons/base/ir/ir_http.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openerp/addons/base/ir/ir_http.py b/openerp/addons/base/ir/ir_http.py index ba402b5b79d..5320a0c0b95 100644 --- a/openerp/addons/base/ir/ir_http.py +++ b/openerp/addons/base/ir/ir_http.py @@ -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: