[IMP] Clearer use of update_module arg.
authorVo Minh Thu <vmt@openerp.com>
Thu, 17 Nov 2011 10:06:08 +0000 (11:06 +0100)
committerVo Minh Thu <vmt@openerp.com>
Thu, 17 Nov 2011 10:06:08 +0000 (11:06 +0100)
- update_module was defined as config[init] or config[update]
- this means it is a mutable dictionary
- the code testing update_module is actually mutating
config[init] and config[update]...
- now update_module is really a True or False value.

bzr revid: vmt@openerp.com-20111117100608-0n8o99slgk42kiiv

openerp-server
openerp/modules/loading.py

index c108d9f..e47a8ea 100755 (executable)
@@ -89,7 +89,8 @@ def setup_pid_file():
 def preload_registry(dbname):
     """ Preload a registry, and start the cron."""
     try:
-        db, registry = openerp.pooler.get_db_and_pool(dbname, update_module=config['init'] or config['update'], pooljobs=False)
+        update_module = True if config['init'] or config['update'] else False
+        db, registry = openerp.pooler.get_db_and_pool(dbname, update_module=update_module, pooljobs=False)
 
         # jobs will start to be processed later, when openerp.cron.start_master_thread() is called by openerp.service.start_services()
         registry.schedule_cron_jobs()
@@ -99,7 +100,8 @@ def preload_registry(dbname):
 def run_test_file(dbname, test_file):
     """ Preload a registry, possibly run a test file, and start the cron."""
     try:
-        db, registry = openerp.pooler.get_db_and_pool(dbname, update_module=config['init'] or config['update'], pooljobs=False)
+        update_module = True if config['init'] or config['update'] else False
+        db, registry = openerp.pooler.get_db_and_pool(dbname, update_module=update_module, pooljobs=False)
         cr = db.cursor()
         logger = logging.getLogger('server')
         logger.info('loading test file %s', test_file)
index 00948bc..6a2e653 100644 (file)
@@ -276,6 +276,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
             tools.config['update']['all'] = 1
             if not tools.config['without_demo']:
                 tools.config["demo"]['all'] = 1
+            update_module = True
 
         # This is a brand new pool, just created in pooler.get_db_and_pool()
         pool = pooler.get_pool(cr.dbname)
@@ -293,7 +294,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
 
         # processed_modules: for cleanup step after install
         # loaded_modules: to avoid double loading
-        loaded_modules, processed_modules = load_module_graph(cr, graph, status, perform_checks=(not update_module), report=report)
+        loaded_modules, processed_modules = load_module_graph(cr, graph, status, report=report)
 
         if tools.config['load_language']:
             for lang in tools.config['load_language'].split(','):