From d31260e8a83d0caad13a519e46cb3d07c3d2730b Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 8 Feb 2011 18:09:27 +0100 Subject: [PATCH] [FIX] tools.config: override root_path in config, and avoid saving it This should help avoid common issues with an obsolete root_path saved in the config file. We also expand the path on-the-fly, and do the same for addons_path. bzr revid: odo@openerp.com-20110208170927-3kqk0c06qmxu2ko5 --- openerp/tools/config.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openerp/tools/config.py b/openerp/tools/config.py index ba12bc74f9a..7d0b04739e4 100644 --- a/openerp/tools/config.py +++ b/openerp/tools/config.py @@ -99,7 +99,7 @@ class configmanager(object): 'osv_memory_age_limit': 1, # hours } - self.blacklist_for_save = set(["publisher_warranty_url", "load_language"]) + self.blacklist_for_save = set(["publisher_warranty_url", "load_language", "root_path"]) self.misc = {} self.config_file = fname @@ -334,10 +334,11 @@ class configmanager(object): else: self.options['log_level'] = self._LOGLEVELS.get(self.options['log_level']) or int(self.options['log_level']) - if not self.options['root_path'] or self.options['root_path']=='None': - self.options['root_path'] = os.path.dirname(openerp.__file__) + self.options['root_path'] = os.path.abspath(os.path.expanduser(os.path.expandvars(os.path.dirname(openerp.__file__)))) if not self.options['addons_path'] or self.options['addons_path']=='None': self.options['addons_path'] = os.path.join(self.options['root_path'], 'addons') + else: + self.options['addons_path'] = os.path.abspath(os.path.expanduser(os.path.expandvars(self.options['addons_path']))) self.options['init'] = opt.init and dict.fromkeys(opt.init.split(','), 1) or {} self.options["demo"] = not opt.without_demo and self.options['init'] or {}