[FIX] config.py: do not use appsdir to define the user's data dir when he has no home directory on unix

Force it to be '/var/lib/(appname)' in this case
This commit is contained in:
Simon Lejeune 2014-09-02 10:59:09 +02:00
parent f2598ecdce
commit 7e41903110
1 changed files with 8 additions and 2 deletions

View File

@ -62,9 +62,15 @@ DEFAULT_LOG_HANDLER = [':INFO']
def _get_default_datadir():
home = os.path.expanduser('~')
func = appdirs.user_data_dir if os.path.exists(home) else appdirs.site_data_dir
if os.path.exists(home):
func = appdirs.user_data_dir
else:
if sys.platform in ['win32', 'darwin']:
func = appdirs.site_data_dir
else:
func = lambda **kwarg: "/var/lib/%s" % kwarg['appname']
# No "version" kwarg as session and filestore paths are shared against series
return func(appname='Odoo', appauthor=release.author)
return func(appname='openerp', appauthor=release.author)
class configmanager(object):
def __init__(self, fname=None):