diff options
author | fuzzyman <devnull@localhost> | 2010-02-07 23:50:02 +0000 |
---|---|---|
committer | fuzzyman <devnull@localhost> | 2010-02-07 23:50:02 +0000 |
commit | faa5e00c495c6bad0481a39d80de3a2545a004f6 (patch) | |
tree | 6b10dfe4cc8c5e55866d473e3067938fb6723226 | |
parent | 6e3de50d92d5568fe0796eb77dfb530a653d06e8 (diff) | |
download | configobj-faa5e00c495c6bad0481a39d80de3a2545a004f6.tar.gz |
Proper options handling.
-rw-r--r-- | configobj.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/configobj.py b/configobj.py index d64e815..20d92b0 100644 --- a/configobj.py +++ b/configobj.py @@ -1208,7 +1208,7 @@ class ConfigObj(Section): 'default_encoding': default_encoding, 'unrepr': unrepr, 'write_empty_values': write_empty_values} - if _options is None: + if options is None: options = _options else: import warnings @@ -1216,12 +1216,11 @@ class ConfigObj(Section): 'deprecated. Use **options instead.', DeprecationWarning, stacklevel=2) - defaults = OPTION_DEFAULTS.copy() # TODO: check the values too. for entry in options: - if entry not in defaults: + if entry not in OPTION_DEFAULTS: raise TypeError('Unrecognised option "%s".' % entry) - for entry, value in defaults.items(): + for entry, value in OPTION_DEFAULTS.items(): if entry not in options: options[entry] = value @@ -1230,10 +1229,8 @@ class ConfigObj(Section): if _inspec: options['list_values'] = False - # Add any explicit options to the defaults - defaults.update(options) - self._initialise(defaults) - configspec = defaults['configspec'] + self._initialise(options) + configspec = options['configspec'] self._original_configspec = configspec self._load(infile, configspec) |