[IMP] Clearer use of update_module arg.

- 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
This commit is contained in:
Vo Minh Thu 2011-11-17 11:06:08 +01:00
parent 9e225c7c1e
commit 330316672f
2 changed files with 6 additions and 3 deletions

View File

@ -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)

View 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(','):