From e746cb1654bac97c41b72fb807644a608da5b46b Mon Sep 17 00:00:00 2001 From: Vo Minh Thu Date: Tue, 12 Feb 2013 09:53:11 +0100 Subject: [PATCH] [FIX] registry: fix a bug where RegistryManager.new() could return an out-of-date registry. bzr revid: vmt@openerp.com-20130212085311-o53wv7yful39kktd --- openerp/modules/module.py | 2 +- openerp/modules/registry.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/openerp/modules/module.py b/openerp/modules/module.py index 98955aff492..ec1c6a1708b 100644 --- a/openerp/modules/module.py +++ b/openerp/modules/module.py @@ -400,7 +400,7 @@ def load_openerp_module(module_name): initialize_sys_path() try: mod_path = get_module_path(module_name) - zip_mod_path = mod_path + '.zip' + zip_mod_path = '' if not mod_path else mod_path + '.zip' if not os.path.isfile(zip_mod_path): __import__('openerp.addons.' + module_name) else: diff --git a/openerp/modules/registry.py b/openerp/modules/registry.py index 4aa20f3349d..b06c500a24c 100644 --- a/openerp/modules/registry.py +++ b/openerp/modules/registry.py @@ -216,6 +216,11 @@ class RegistryManager(object): del cls.registries[db_name] raise + # load_modules() above can replace the registry by calling + # indirectly new() again (when modules have to be uninstalled). + # Yeah, crazy. + registry = cls.registries[db_name] + cr = registry.db.cursor() try: Registry.setup_multi_process_signaling(cr)