diff --git a/mylib/config.py b/mylib/config.py index dbadc31..688c007 100644 --- a/mylib/config.py +++ b/mylib/config.py @@ -43,6 +43,7 @@ class BaseOption: # pylint: disable=too-many-instance-attributes self.arg = arg self.short_arg = short_arg self.arg_help = arg_help if arg_help else comment + self._set = False @property def _isset_in_options(self): @@ -93,7 +94,7 @@ class BaseOption: # pylint: disable=too-many-instance-attributes def get(self): """ 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 if self._isset_in_config_file: 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) ) - if self.config.options and not self.no_arg: - setattr(self.config.options, self.parser_dest, value) + self._set = True @property def parser_action(self):