[fix] problem with authentification detection
bzr revid: nicolas.vanhoren@openerp.com-20110914095139-ya200r6rc7qkxn33
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user