[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:
niv-openerp 2011-09-30 15:07:29 +02:00
parent c3a9330838
commit d364df65ce
2 changed files with 10 additions and 3 deletions

View File

@ -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

View File

@ -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
@ -38,6 +38,12 @@ class OpenERPSession(object):
self.context = {}
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,