mirror of
https://github.com/certbot/certbot.git
synced 2026-06-09 00:32:12 -04:00
Add has_default_value method
This commit is contained in:
parent
aaf93b65b0
commit
8c174f38b5
1 changed files with 16 additions and 3 deletions
|
|
@ -217,6 +217,21 @@ def set_by_cli(var):
|
|||
set_by_cli.detector = None
|
||||
|
||||
|
||||
def has_default_value(option, value):
|
||||
"""Does option have the default value?
|
||||
|
||||
If the default value of option is not known, False is returned.
|
||||
|
||||
:param str option: configuration variable being considered
|
||||
:param value: value of the configuration variable named option
|
||||
|
||||
:returns: True if option has the default value, otherwise, False
|
||||
:rtype: bool
|
||||
|
||||
"""
|
||||
return option in DEFAULTS and DEFAULTS[option] == value
|
||||
|
||||
|
||||
def option_was_set(option, value):
|
||||
"""Was option set by the user or does it differ from the default?
|
||||
|
||||
|
|
@ -227,9 +242,7 @@ def option_was_set(option, value):
|
|||
:rtype: bool
|
||||
|
||||
"""
|
||||
return (set_by_cli(option) or
|
||||
option not in DEFAULTS or
|
||||
DEFAULTS[option] != value)
|
||||
return set_by_cli(option) or not has_default_value(option, value)
|
||||
|
||||
|
||||
def argparse_type(variable):
|
||||
|
|
|
|||
Loading…
Reference in a new issue