[FIX] Behavior of server corrected if addons-path is wrong

lp bug: https://launchpad.net/bugs/373176 fixed

bzr revid: jvo@tinyerp.com-20100128055657-mw7o3k1fkyvpr3on
This commit is contained in:
Jay (Open ERP)
2010-01-28 11:26:57 +05:30
parent 8cd2c6cc4f
commit 32c48f4310
2 changed files with 16 additions and 0 deletions
+4
View File
@@ -320,6 +320,7 @@ def upgrade_graph(graph, cr, module_list, force=None):
mod_path = get_module_path(module)
terp_file = get_module_resource(module, '__terp__.py')
if not mod_path or not terp_file:
global not_loaded
not_loaded.append(module)
logger.notifyChannel('init', netsvc.LOG_WARNING, 'module %s: not installable' % (module))
raise osv.osv.except_osv('Error!',"Module '%s' was not found" % (module,))
@@ -710,8 +711,11 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
graph = create_graph(cr, ['base'], force)
has_updates = load_module_graph(cr, graph, status, perform_checks=(not update_module), report=report)
global not_loaded
if not_loaded:
#If some module is not loaded don't proceed further
not_loaded = []
return
if update_module:
modobj = pool.get('ir.module.module')
+12
View File
@@ -347,6 +347,18 @@ class configmanager(object):
res = os.path.abspath(os.path.expanduser(value))
if not os.path.exists(res):
raise optparse.OptionValueError("option %s: no such directory: %r" % (opt, value))
contains_addons = False
for f in os.listdir(res):
modpath = os.path.join(res, f)
if os.path.isdir(modpath) and os.path.exists(os.path.join(modpath, '__init__.py')) and \
os.path.exists(os.path.join(modpath, '__terp__.py')):
contains_addons = True
break
if not contains_addons:
raise optparse.OptionValueError("option %s: The addons-path %r does not seem to a be a valid Addons Directory!" % (opt, value))
setattr(parser.values, option.dest, res)
def load(self):