diff --git a/addons/web/__openerp__.py b/addons/web/__openerp__.py
index bb9fcaa0dbd..9ea84a3501f 100644
--- a/addons/web/__openerp__.py
+++ b/addons/web/__openerp__.py
@@ -20,7 +20,6 @@ This module provides the core of the OpenERP Web Client.
"static/lib/datejs/sugarpak.js",
"static/lib/datejs/extras.js",
"static/lib/jquery/jquery.js",
- "static/lib/jquery.MD5/jquery.md5.js",
"static/lib/jquery.form/jquery.form.js",
"static/lib/jquery.validate/jquery.validate.js",
"static/lib/jquery.ba-bbq/jquery.ba-bbq.js",
@@ -66,6 +65,7 @@ This module provides the core of the OpenERP Web Client.
"static/lib/jquery.tipsy/tipsy.css",
"static/lib/jquery.textext/jquery.textext.css",
"static/lib/fontawesome/css/font-awesome.css",
+ "static/lib/bootstrap/css/bootstrap.css",
"static/src/css/base.css",
"static/src/css/data_export.css",
"static/lib/cleditor/jquery.cleditor.css",
@@ -89,5 +89,4 @@ This module provides the core of the OpenERP Web Client.
"static/test/list-editable.js",
"static/test/mutex.js"
],
- 'bootstrap': True,
}
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index 41bb6ccfca7..8f7c5d4f70d 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -3,6 +3,7 @@
import ast
import base64
import csv
+import functools
import glob
import itertools
import logging
@@ -35,7 +36,9 @@ from openerp.tools.translate import _
from openerp.tools import config
from openerp import http
-from openerp.http import request
+from openerp.http import request, serialize_exception as _serialize_exception
+
+_logger = logging.getLogger(__name__)
#----------------------------------------------------------
# OpenERP Web helpers
@@ -89,6 +92,22 @@ db_list = http.db_list
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
@@ -542,14 +561,14 @@ class Home(http.Controller):
def redirect(db):
query = dict(urlparse.parse_qsl(request.httprequest.query_string, keep_blank_values=True))
- query.update({'db': db})
+ query['db'] = db
redirect = request.httprequest.path + '?' + urllib.urlencode(query)
return redirect_with_hash(redirect)
if db is None and guessed_db is not None:
return redirect(guessed_db)
- if db is not None and db != guessed_db:
+ if db is not None and db != request.session.db:
request.session.logout()
request.session.db = db
guessed_db = db
@@ -1220,6 +1239,7 @@ class Binary(http.Controller):
return open(os.path.join(addons_path, 'web', 'static', 'src', 'img', image), 'rb').read()
@http.route('/web/binary/saveas', type='http', auth="user")
+ @serialize_exception
def saveas(self, model, field, id=None, filename_field=None, **kw):
""" Download link for files stored as binary fields.
@@ -1253,6 +1273,7 @@ class Binary(http.Controller):
('Content-Disposition', content_disposition(filename))])
@http.route('/web/binary/saveas_ajax', type='http', auth="user")
+ @serialize_exception
def saveas_ajax(self, data, token):
jdata = simplejson.loads(data)
model = jdata['model']
@@ -1286,6 +1307,7 @@ class Binary(http.Controller):
cookies={'fileToken': token})
@http.route('/web/binary/upload', type='http', auth="user")
+ @serialize_exception
def upload(self, callback, ufile):
# TODO: might be useful to have a configuration flag for max-length file uploads
out = """
-
-
-
-
-