From 23ad48a91be24f49471371021ce94347fd599e71 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 10 Dec 2014 13:49:12 +0100 Subject: [PATCH] [FIX] config: a list is always equal to itself add_option(action=append*) always modifies the ``default`` list in-place. When using DEFAULT_LOG_HANDLER directly, that means log_handler is always equal to DEFAULT_LOG_HANDLER since they're the same list object. Thus the --log-handler command-line would never overwrite the log_handler value from the configuration file, which is unexpected Fix that by copying DEFAULT_LOG_HANDLER before passing it as the option's default value. --- openerp/tools/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/tools/config.py b/openerp/tools/config.py index e53f3a36b4e..0a9a69c7b12 100644 --- a/openerp/tools/config.py +++ b/openerp/tools/config.py @@ -189,7 +189,7 @@ class configmanager(object): group.add_option("--logfile", dest="logfile", help="file where the server log will be stored") group.add_option("--logrotate", dest="logrotate", action="store_true", my_default=False, help="enable logfile rotation") group.add_option("--syslog", action="store_true", dest="syslog", my_default=False, help="Send the log to the syslog server") - group.add_option('--log-handler', action="append", default=DEFAULT_LOG_HANDLER, my_default=DEFAULT_LOG_HANDLER, metavar="PREFIX:LEVEL", help='setup a handler at LEVEL for a given PREFIX. An empty PREFIX indicates the root logger. This option can be repeated. Example: "openerp.orm:DEBUG" or "werkzeug:CRITICAL" (default: ":INFO")') + group.add_option('--log-handler', action="append", default=list(DEFAULT_LOG_HANDLER), my_default=list(DEFAULT_LOG_HANDLER), metavar="PREFIX:LEVEL", help='setup a handler at LEVEL for a given PREFIX. An empty PREFIX indicates the root logger. This option can be repeated. Example: "openerp.orm:DEBUG" or "werkzeug:CRITICAL" (default: ":INFO")') group.add_option('--log-request', action="append_const", dest="log_handler", const="openerp.http.rpc.request:DEBUG", help='shortcut for --log-handler=openerp.http.rpc.request:DEBUG') group.add_option('--log-response', action="append_const", dest="log_handler", const="openerp.http.rpc.response:DEBUG", help='shortcut for --log-handler=openerp.http.rpc.response:DEBUG') group.add_option('--log-web', action="append_const", dest="log_handler", const="openerp.http:DEBUG", help='shortcut for --log-handler=openerp.http:DEBUG')