[IMP] addons.init: handle properly empty update/init module spec
authorOlivier Dony <odo@openerp.com>
Tue, 21 Sep 2010 14:25:25 +0000 (16:25 +0200)
committerOlivier Dony <odo@openerp.com>
Tue, 21 Sep 2010 14:25:25 +0000 (16:25 +0200)
bzr revid: odo@openerp.com-20100921142525-2vjy7njophpl77bf

bin/addons/__init__.py

index 3e06256..297cf73 100644 (file)
@@ -762,12 +762,13 @@ def _check_module_names(cr, module_names):
     if 'base' in mod_names:
         # ignore dummy 'all' module
         mod_names.remove('all')
-    cr.execute("SELECT count(id) AS count FROM ir_module_module WHERE name in %s", (tuple(mod_names),))
-    if cr.dictfetchone()['count'] != len(mod_names):
-        # find out what module name(s) are incorrect:
-        cr.execute("SELECT name FROM ir_module_module")
-        incorrect_names = mod_names.difference([x['name'] for x in cr.dictfetchall()])
-        logging.getLogger('init').warning('invalid module names, ignored: %s', ", ".join(incorrect_names))
+    if mod_names:
+        cr.execute("SELECT count(id) AS count FROM ir_module_module WHERE name in %s", (tuple(mod_names),))
+        if cr.dictfetchone()['count'] != len(mod_names):
+            # find out what module name(s) are incorrect:
+            cr.execute("SELECT name FROM ir_module_module")
+            incorrect_names = mod_names.difference([x['name'] for x in cr.dictfetchall()])
+            logging.getLogger('init').warning('invalid module names, ignored: %s', ", ".join(incorrect_names))
 
 def load_modules(db, force_demo=False, status=None, update_module=False):
     if not status: