From 8769c57e941652aafc910c9deb69bbe5c544f6fa Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 22 Nov 2011 13:08:06 +0100 Subject: [PATCH] [FIX] session merging bzr revid: chs@openerp.com-20111122120806-mlg170fohfnx8gk8 --- addons/web/common/http.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/web/common/http.py b/addons/web/common/http.py index 7352a6f5cb9..aadae03832e 100644 --- a/addons/web/common/http.py +++ b/addons/web/common/http.py @@ -374,12 +374,14 @@ def session_context(request, storage_path, session_cookie='sessionid'): # either by login process or by HTTP requests without an OpenERP # session id, and are generally noise for key, value in request.session.items(): - if isinstance(value, session.OpenERPSession) and not value._uid and not value.jsonp_requests: + if (isinstance(value, session.OpenERPSession) + and not value._uid + and not value.jsonp_requests + ): _logger.info('remove session %s: %r', key, value.jsonp_requests) del request.session[key] with session_lock: - # FIXME: remove this when non-literals disappear if sid: # Re-load sessions from storage and merge non-literal # contexts and domains (they're indexed by hash of the @@ -402,6 +404,11 @@ def session_context(request, storage_path, session_cookie='sessionid'): v.domains_store.update(stored.domains_store) v.jsonp_requests.update(stored.jsonp_requests) + # add missing keys + for k, v in in_store.iteritems(): + if k not in request.session: + request.session[k] = v + session_store.save(request.session) #----------------------------------------------------------