db_monodb = http.db_monodb
+def serialize_exception(f):
+ @functools.wraps(f)
+ def wrap(*args, **kwargs):
+ try:
+ return f(*args, **kwargs)
+ except Exception, e:
+ _logger.exception("An exception occured during an http request")
+ se = _serialize_exception(e)
+ error = {
+ 'code': 200,
+ 'message': "OpenERP Server Error",
+ 'data': se
+ }
+ return werkzeug.exceptions.InternalServerError(simplejson.dumps(error))
+ return wrap
+
def redirect_with_hash(url, code=303):
- if request.httprequest.user_agent.browser in ('msie', 'safari'):
- # Most IE and Safari versions decided not to preserve location.hash upon
- # redirect. And even if IE10 pretends to support it, it still fails
- # inexplicably in case of multiple redirects (and we do have some).
- # See extensive test page at http://greenbytes.de/tech/tc/httpredirects/
- return "<html><head><script>window.location = '%s' + location.hash;</script></head></html>" % url
- return werkzeug.utils.redirect(url, code)
+ # Most IE and Safari versions decided not to preserve location.hash upon
+ # redirect. And even if IE10 pretends to support it, it still fails
+ # inexplicably in case of multiple redirects (and we do have some).
+ # See extensive test page at http://greenbytes.de/tech/tc/httpredirects/
+ return "<html><head><script>window.location = '%s' + location.hash;</script></head></html>" % url
def module_topological_sort(modules):
""" Return a list of module names sorted so that their dependencies of the