[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:
@@ -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(
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user