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: