diff options
author | fuzzyman <devnull@localhost> | 2010-02-07 22:59:50 +0000 |
---|---|---|
committer | fuzzyman <devnull@localhost> | 2010-02-07 22:59:50 +0000 |
commit | 6e3de50d92d5568fe0796eb77dfb530a653d06e8 (patch) | |
tree | 0691c0b1f94bba6d060126b05c4116402859bec8 | |
parent | d7fe22989fa1e6682e3bbe68ee8ea213b75b13ef (diff) | |
download | configobj-6e3de50d92d5568fe0796eb77dfb530a653d06e8.tar.gz |
More 4.7.1 release fixes.
-rw-r--r-- | configobj.py | 29 | ||||
-rw-r--r-- | setup.py | 6 |
2 files changed, 20 insertions, 15 deletions
diff --git a/configobj.py b/configobj.py index 34260d2..d64e815 100644 --- a/configobj.py +++ b/configobj.py @@ -1199,11 +1199,6 @@ class ConfigObj(Section): Section.__init__(self, self, 0, self) infile = infile or [] - if options is not None: - import warnings - warnings.warn('Passing in an options dictionary to ConfigObj() is ' - 'deprecated. Use **options instead.', - DeprecationWarning, stacklevel=2) _options = {'configspec': configspec, 'encoding': encoding, 'interpolation': interpolation, @@ -1213,20 +1208,28 @@ class ConfigObj(Section): 'default_encoding': default_encoding, 'unrepr': unrepr, 'write_empty_values': write_empty_values} - options = dict(options or {}) - options.update(_options) + if _options is None: + options = _options + else: + import warnings + warnings.warn('Passing in an options dictionary to ConfigObj() is ' + '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: + raise TypeError('Unrecognised option "%s".' % entry) + for entry, value in defaults.items(): + if entry not in options: + options[entry] = value # XXXX this ignores an explicit list_values = True in combination # with _inspec. The user should *never* do that anyway, but still... if _inspec: options['list_values'] = False - defaults = OPTION_DEFAULTS.copy() - # TODO: check the values too. - for entry in options: - if entry not in defaults: - raise TypeError('Unrecognised option "%s".' % entry) - # Add any explicit options to the defaults defaults.update(options) self._initialise(defaults) @@ -42,8 +42,10 @@ It has lots of other features though : * The order of keys/sections is preserved * Powerful ``unrepr`` mode for storing/retrieving Python data-types -Release 4.7.0 improves performance adds features for validation and -fixes some bugs.""" +| Release 4.7.1 fixes a bug with the deprecated options keyword in +| 4.7.0. +| Release 4.7.0 improves performance adds features for validation and +| fixes some bugs.""" CLASSIFIERS = [ 'Development Status :: 6 - Mature', |