[FIX] data-dir management
- sessions are now shared between series. - use site data dir instead of user data dir if user has no home dir. - in http and module handling, `data-dir` was used before being initialized, using the default value instead of user input (fixes #308, #904)
This commit is contained in:
parent
139d868c94
commit
e5b0933743
|
@ -1145,11 +1145,14 @@ class Root(object):
|
||||||
"""Root WSGI application for the OpenERP Web Client.
|
"""Root WSGI application for the OpenERP Web Client.
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self._loaded = False
|
||||||
|
|
||||||
|
@lazy_property
|
||||||
|
def session_store(self):
|
||||||
# Setup http sessions
|
# Setup http sessions
|
||||||
path = openerp.tools.config.session_dir
|
path = openerp.tools.config.session_dir
|
||||||
_logger.debug('HTTP sessions stored in: %s', path)
|
_logger.debug('HTTP sessions stored in: %s', path)
|
||||||
self.session_store = werkzeug.contrib.sessions.FilesystemSessionStore(path, session_class=OpenERPSession)
|
return werkzeug.contrib.sessions.FilesystemSessionStore(path, session_class=OpenERPSession)
|
||||||
self._loaded = False
|
|
||||||
|
|
||||||
@lazy_property
|
@lazy_property
|
||||||
def nodb_routing_map(self):
|
def nodb_routing_map(self):
|
||||||
|
|
|
@ -43,7 +43,7 @@ MANIFEST = '__openerp__.py'
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# addons path as a list
|
# addons path as a list
|
||||||
ad_paths = [tools.config.addons_data_dir]
|
ad_paths = []
|
||||||
hooked = False
|
hooked = False
|
||||||
|
|
||||||
# Modules already loaded
|
# Modules already loaded
|
||||||
|
@ -89,6 +89,10 @@ def initialize_sys_path():
|
||||||
global ad_paths
|
global ad_paths
|
||||||
global hooked
|
global hooked
|
||||||
|
|
||||||
|
dd = tools.config.addons_data_dir
|
||||||
|
if dd not in ad_paths:
|
||||||
|
ad_paths.append(dd)
|
||||||
|
|
||||||
for ad in tools.config['addons_path'].split(','):
|
for ad in tools.config['addons_path'].split(','):
|
||||||
ad = os.path.abspath(tools.ustr(ad.strip()))
|
ad = os.path.abspath(tools.ustr(ad.strip()))
|
||||||
if ad not in ad_paths:
|
if ad not in ad_paths:
|
||||||
|
|
|
@ -61,7 +61,10 @@ def check_ssl():
|
||||||
DEFAULT_LOG_HANDLER = [':INFO']
|
DEFAULT_LOG_HANDLER = [':INFO']
|
||||||
|
|
||||||
def _get_default_datadir():
|
def _get_default_datadir():
|
||||||
return appdirs.user_data_dir(appname='OpenERP', appauthor=release.author)
|
home = os.path.expanduser('~')
|
||||||
|
func = appdirs.user_data_dir if os.path.exists(home) else appdirs.site_data_dir
|
||||||
|
# No "version" kwarg as session and filestore paths are shared against series
|
||||||
|
return func(appname='Odoo', appauthor=release.author)
|
||||||
|
|
||||||
class configmanager(object):
|
class configmanager(object):
|
||||||
def __init__(self, fname=None):
|
def __init__(self, fname=None):
|
||||||
|
@ -649,7 +652,7 @@ class configmanager(object):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def session_dir(self):
|
def session_dir(self):
|
||||||
d = os.path.join(self['data_dir'], 'sessions', release.series)
|
d = os.path.join(self['data_dir'], 'sessions')
|
||||||
if not os.path.exists(d):
|
if not os.path.exists(d):
|
||||||
os.makedirs(d, 0700)
|
os.makedirs(d, 0700)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue