[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.
This commit is contained in:
parent
ec6fa5d3d9
commit
23ad48a91b
|
@ -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("--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("--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("--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-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-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')
|
group.add_option('--log-web', action="append_const", dest="log_handler", const="openerp.http:DEBUG", help='shortcut for --log-handler=openerp.http:DEBUG')
|
||||||
|
|
Loading…
Reference in New Issue