[FIX] ensure default addon paths are valid (existing)
User-provided addons paths are checked for existence (and rejected), but default addons paths are not checked, and blow up when trying to listdir them (e.g. when http.py tries to load modules). This is an issue when using Odoo from the distributed tarballs, because the packaging currently moves all modules to openerp/addons and removes the root ("main") addons directory.
This commit is contained in:
parent
4630226514
commit
a2115ef544
|
@ -445,9 +445,14 @@ class configmanager(object):
|
|||
|
||||
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':
|
||||
default_addons = []
|
||||
base_addons = os.path.join(self.options['root_path'], 'addons')
|
||||
if os.path.exists(base_addons):
|
||||
default_addons.append(base_addons)
|
||||
main_addons = os.path.abspath(os.path.join(self.options['root_path'], '../addons'))
|
||||
self.options['addons_path'] = '%s,%s' % (base_addons, main_addons)
|
||||
if os.path.exists(main_addons):
|
||||
default_addons.append(main_addons)
|
||||
self.options['addons_path'] = ','.join(default_addons)
|
||||
else:
|
||||
self.options['addons_path'] = ",".join(
|
||||
os.path.abspath(os.path.expanduser(os.path.expandvars(x)))
|
||||
|
|
Loading…
Reference in New Issue