[fix] problem with authentification detection

bzr revid: nicolas.vanhoren@openerp.com-20110914095139-ya200r6rc7qkxn33
This commit is contained in:
niv-openerp
2011-09-14 11:51:39 +02:00
parent 8eb4f30d90
commit 655ed47c06
2 changed files with 3 additions and 5 deletions
+2 -1
View File
@@ -23,6 +23,7 @@ import nonliterals
import http
# import backendlocal as backend
import session as backend
import openerplib
__all__ = ['Root', 'jsonrequest', 'httprequest', 'Controller',
'WebRequest', 'JsonRequest', 'HttpRequest']
@@ -166,7 +167,7 @@ class JsonRequest(WebRequest):
_logger.debug("--> %s.%s\n%s", controller.__class__.__name__, method.__name__, pprint.pformat(self.jsonrequest))
response['id'] = self.jsonrequest.get('id')
response["result"] = method(controller, self, **self.params)
except backend.OpenERPUnboundException:
except openerplib.AuthentificationError:
error = {
'code': 100,
'message': "OpenERP Session Invalid",
+1 -4
View File
@@ -8,8 +8,6 @@ import nonliterals
#----------------------------------------------------------
# OpenERPSession RPC openerp backend access
#----------------------------------------------------------
class OpenERPUnboundException(Exception):
pass
class OpenERPSession(object):
"""
@@ -68,8 +66,7 @@ class OpenERPSession(object):
"""
Ensures this session is valid (logged into the openerp server)
"""
if not (self._db and self._uid and self._password):
raise OpenERPUnboundException()
self.build_connection().check_login(False)
def execute(self, model, func, *l, **d):
self.assert_valid()