bugfix_empty_dir
authorFabien Pinckaers <fp@tinyerp.com>
Mon, 27 Oct 2008 12:18:52 +0000 (13:18 +0100)
committerFabien Pinckaers <fp@tinyerp.com>
Mon, 27 Oct 2008 12:18:52 +0000 (13:18 +0100)
bzr revid: fp@tinyerp.com-20081027121852-hcmyfyqbcdlk8cuz

bin/addons/__init__.py
bin/tools/misc.py

index 0144191..1f9f3be 100644 (file)
@@ -142,6 +142,8 @@ def get_module_path(module):
     if os.path.exists(opj(_ad, module)) or os.path.exists(opj(_ad, '%s.zip' % module)):
         return opj(_ad, module)
 
+    logger.notifyChannel('init', netsvc.LOG_WARNING, 'addon:%s:module not found' % (module,))
+    return False
     raise IOError, 'Module not found : %s' % module
 
 def get_module_resource(module, *args):
@@ -152,7 +154,8 @@ def get_module_resource(module, *args):
 
     @return: absolute path to the resource
     """
-    return opj(get_module_path(module), *args)
+    a = get_module_path(module)
+    return a and opj(a, *args) or False
 
 def get_modules():
     """Returns the list of module names
@@ -178,6 +181,7 @@ def create_graph(module_list, force=None):
         except IOError:
             continue
         terp_file = get_module_resource(module, '__terp__.py')
+        if not terp_file: continue
         if os.path.isfile(terp_file) or zipfile.is_zipfile(mod_path):
             try:
                 info = eval(tools.file_open(terp_file).read())
index 9e292c9..65c9c8c 100644 (file)
@@ -62,6 +62,8 @@ def init_db(cr):
     for i in addons.get_modules():
         terp_file = addons.get_module_resource(i, '__terp__.py')
         mod_path = addons.get_module_path(i)
+        if not mod_path:
+            continue
         info = False
         if os.path.isfile(terp_file) and not os.path.isfile(mod_path+'.zip'):
             info = eval(file(terp_file).read())