From db10e1d3a51cd0e315ee8e4fcc80ffe9b6499fbf Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 16 Jan 2014 17:41:42 +0100 Subject: [PATCH] [FIX] http: store sessions in data-dir bzr revid: chs@openerp.com-20140116164142-ikcw82lyfopoj46k --- openerp/http.py | 23 +---------------------- openerp/tools/config.py | 2 +- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/openerp/http.py b/openerp/http.py index 7069cbdeefe..9b632348280 100644 --- a/openerp/http.py +++ b/openerp/http.py @@ -830,33 +830,12 @@ class DisableCacheMiddleware(object): start_response(status, new_headers) return self.app(environ, start_wrapped) -def session_path(): - try: - import pwd - username = pwd.getpwuid(os.geteuid()).pw_name - except ImportError: - try: - username = getpass.getuser() - except Exception: - username = "unknown" - path = os.path.join(tempfile.gettempdir(), "oe-sessions-" + username) - try: - os.mkdir(path, 0700) - except OSError as exc: - if exc.errno == errno.EEXIST: - # directory exists: ensure it has the correct permissions - # this will fail if the directory is not owned by the current user - os.chmod(path, 0700) - else: - raise - return path - class Root(object): """Root WSGI application for the OpenERP Web Client. """ def __init__(self): # Setup http sessions - path = session_path() + path = os.path.join(openerp.tools.config.session_dir _logger.debug('HTTP sessions stored in: %s', path) self.session_store = werkzeug.contrib.sessions.FilesystemSessionStore(path, session_class=OpenERPSession) diff --git a/openerp/tools/config.py b/openerp/tools/config.py index bd87a0d4b44..a9e4a8a3276 100644 --- a/openerp/tools/config.py +++ b/openerp/tools/config.py @@ -633,7 +633,7 @@ class configmanager(object): @property def session_dir(self): - d = os.path.join(self['data_dir'], 'sessions') + d = os.path.join(self['data_dir'], 'sessions', release.series) if not os.path.exists(d): os.makedirs(d) return d