[fix] lot of potential problems when we change something in the code due to the pickled session containing the config
bzr revid: nicolas.vanhoren@openerp.com-20110930130729-yfys0tklsujgm3ti
This commit is contained in:
parent
c3a9330838
commit
d364df65ce
|
@ -98,7 +98,8 @@ class WebRequest(object):
|
|||
self.params = dict(params)
|
||||
# OpenERP session setup
|
||||
self.session_id = self.params.pop("session_id", None) or uuid.uuid4().hex
|
||||
self.session = self.httpsession.setdefault(self.session_id, session.OpenERPSession(self.config))
|
||||
self.session = self.httpsession.setdefault(self.session_id, session.OpenERPSession())
|
||||
self.session.config = self.config
|
||||
self.context = self.params.pop('context', None)
|
||||
self.debug = self.params.pop('debug', False) != False
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ class OpenERPSession(object):
|
|||
Used to store references to non-literal domains which need to be
|
||||
round-tripped to the client browser.
|
||||
"""
|
||||
def __init__(self, config):
|
||||
self.config = config
|
||||
def __init__(self):
|
||||
self.config = None
|
||||
self._db = False
|
||||
self._uid = False
|
||||
self._login = False
|
||||
|
@ -39,6 +39,12 @@ class OpenERPSession(object):
|
|||
self.contexts_store = {}
|
||||
self.domains_store = {}
|
||||
|
||||
def __getstate__(self):
|
||||
state = dict(self.__dict__)
|
||||
if "config" in state:
|
||||
del state['config']
|
||||
return state
|
||||
|
||||
def build_connection(self):
|
||||
conn = openerplib.Connection(self.config.connector, database=self._db, login=self._login,
|
||||
user_id=self._uid, password=self._password)
|
||||
|
|
Loading…
Reference in New Issue