From ff679b97aad3dd43595be4155d4ce43a7ba40ec9 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Fri, 25 Jul 2014 15:29:10 +0200 Subject: [PATCH] [FIX] Temporary disable addons subcommand auto discovery The problem with the current approach is that it imports all modules in order to discover which one exposes a subcommand by subclassing openerp.cli.Command. At that time, the arguments are not parsed in order to setup the config because a subcommand could potentialy alter the command line arguments (which is the case of `start`) This behavior causes the modules to be imported with the default config and all the modules using some config keys at startup won't have to value they are supposed to have when considering the shared command line switches. Long story short: $ odoo --workers=6 is ok, but $ odoo start --workers=6 is not. As the automatic subcommands are not used yet, we temporary disable it until as proper solution is found. --- openerp/cli/__init__.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/openerp/cli/__init__.py b/openerp/cli/__init__.py index 31582d95292..8a26113b2f4 100644 --- a/openerp/cli/__init__.py +++ b/openerp/cli/__init__.py @@ -52,17 +52,14 @@ def main(): # Default legacy command command = "server" + # TODO: find a way to properly discover addons subcommands without importing the world # Subcommand discovery if len(args) and not args[0].startswith("-"): - logging.disable(logging.CRITICAL) - for m in module.get_modules(): - m = 'openerp.addons.' + m - __import__(m) - #try: - #except Exception, e: - # raise - # print e - logging.disable(logging.NOTSET) + # logging.disable(logging.CRITICAL) + # for m in module.get_modules(): + # m = 'openerp.addons.' + m + # __import__(m) + # logging.disable(logging.NOTSET) command = args[0] args = args[1:]