summaryrefslogtreecommitdiff
path: root/configobj.py
diff options
context:
space:
mode:
authorfuzzyman <devnull@localhost>2010-02-07 22:59:50 +0000
committerfuzzyman <devnull@localhost>2010-02-07 22:59:50 +0000
commit6e3de50d92d5568fe0796eb77dfb530a653d06e8 (patch)
tree0691c0b1f94bba6d060126b05c4116402859bec8 /configobj.py
parentd7fe22989fa1e6682e3bbe68ee8ea213b75b13ef (diff)
downloadconfigobj-6e3de50d92d5568fe0796eb77dfb530a653d06e8.tar.gz
More 4.7.1 release fixes.
Diffstat (limited to 'configobj.py')
-rw-r--r--configobj.py29
1 files changed, 16 insertions, 13 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)