[IMP] ir_http: don't handle exception in dev mode but use the werkzeug debugger except if cause has been already identified (website Qweb)

This commit is contained in:
Jeremy Kersten
2014-12-08 16:25:30 +01:00
parent 44880fac3c
commit 70ab2a6ed1
3 changed files with 8 additions and 1 deletions
+2
View File
@@ -211,6 +211,8 @@ class ir_http(orm.AbstractModel):
# if parent excplicitely returns a plain response, then we don't touch it
return response
except Exception, e:
if openerp.tools.config['dev_mode'] and (not isinstance(exception, ir_qweb.QWebException) or not exception.qweb.get('cause')):
raise
exception = e
values = dict(
+4 -1
View File
@@ -96,6 +96,10 @@ class ir_http(osv.AbstractModel):
def _handle_exception(self, exception):
# If handle_exception returns something different than None, it will be used as a response
# Don't handle exception but use werkeug debugger if server in --dev mode
if openerp.tools.config['dev_mode']:
raise
try:
return request._handle_exception(exception)
except openerp.exceptions.AccessDenied:
@@ -119,7 +123,6 @@ class ir_http(osv.AbstractModel):
if processing:
return processing
# set and execute handler
try:
request.set_handler(func, arguments, auth_method)
+2
View File
@@ -19,6 +19,7 @@ import time
import unittest2
import werkzeug.serving
from werkzeug.debug import DebuggedApplication
if os.name == 'posix':
# Unix only for workers
@@ -894,6 +895,7 @@ def start(preload=None, stop=False):
watcher.start()
else:
_logger.warning("'watchdog' module not installed. Code autoreload feature is disabled")
server.app = DebuggedApplication(server.app, evalex=True)
rc = server.run(preload, stop)