[FIX] problem when multiple instances of the web client run in tabs and we disconnect from one tab, now displays a better error message

lp bug: https://launchpad.net/bugs/1093671 fixed

bzr revid: nicolas.vanhoren@openerp.com-20130108164104-7wv2yxlrczqmicvb
This commit is contained in:
niv-openerp
2013-01-08 17:41:04 +01:00
parent c46be224e6
commit b8180f4c09
2 changed files with 10 additions and 0 deletions
+5
View File
@@ -18,6 +18,9 @@ _logger = logging.getLogger(__name__)
class AuthenticationError(Exception):
pass
class SessionExpiredException(Exception):
pass
class Service(object):
def __init__(self, session, service_name):
self.session = session
@@ -152,6 +155,8 @@ class OpenERPSession(object):
:type model: str
:rtype: a model object
"""
if self._db == False:
raise SessionExpiredException("Session expired")
return Model(self, model)
+5
View File
@@ -247,6 +247,11 @@ instance.web.CrashManager = instance.web.Class.extend({
if (!this.active) {
return;
}
// yes, exception handling is shitty
if (error.code === 300 && error.data && error.data.type == "client_exception" && error.data.debug.match("SessionExpiredException")) {
this.show_warning({type: "Session Expired", data: { fault_code: "Your OpenERP session expired. Please refresh the current web page." }});
return;
}
if (error.data.fault_code) {
var split = ("" + error.data.fault_code).split('\n')[0].split(' -- ');
if (split.length > 1) {