config: if option value was previously set, ignore from options value
This commit is contained in:
parent
5fefc1ed84
commit
56162452ac
1 changed files with 3 additions and 3 deletions
|
@ -43,6 +43,7 @@ class BaseOption: # pylint: disable=too-many-instance-attributes
|
||||||
self.arg = arg
|
self.arg = arg
|
||||||
self.short_arg = short_arg
|
self.short_arg = short_arg
|
||||||
self.arg_help = arg_help if arg_help else comment
|
self.arg_help = arg_help if arg_help else comment
|
||||||
|
self._set = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _isset_in_options(self):
|
def _isset_in_options(self):
|
||||||
|
@ -93,7 +94,7 @@ class BaseOption: # pylint: disable=too-many-instance-attributes
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
""" Get option value from options, config or default """
|
""" Get option value from options, config or default """
|
||||||
if self._isset_in_options:
|
if self._isset_in_options and not self._set:
|
||||||
return self._from_options
|
return self._from_options
|
||||||
if self._isset_in_config_file:
|
if self._isset_in_config_file:
|
||||||
return self._from_config
|
return self._from_config
|
||||||
|
@ -118,8 +119,7 @@ class BaseOption: # pylint: disable=too-many-instance-attributes
|
||||||
self.section.name, self.name, self.to_config(value)
|
self.section.name, self.name, self.to_config(value)
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.config.options and not self.no_arg:
|
self._set = True
|
||||||
setattr(self.config.options, self.parser_dest, value)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def parser_action(self):
|
def parser_action(self):
|
||||||
|
|
Loading…
Reference in a new issue