This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ggenellina
Recipients
Date 2004-12-22.22:23:31
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
ConfigParser.get has an optional argument vars that -
according to the docstring- "which must be a dictionary 
whose contents overrides any pre-existing defaults."
I understand that it overrides the default values, but 
should not override an actual value existing in the file. 
That is, given this contents:

[DEFAULT]
key1=default1

[section]
key2=value2

vars={'key1:vars1','key2:vars2'}

cfg.get('section','key1',0,vars) gives 'vars1' (ok)

cfg.get('section','key2',0,vars) gives 'vars2' (wrong, 
should be 'value2', since key2 is actually in the section 
and no default is needed).

To correct this behavior, simply move this two lines of 
code up in ConfigParser.get (ConfigParser.py), just below 
the first line and before the first try/except:

        # Update with the entry specific variables
        if vars is not None:
            d.update(vars)
History
Date User Action Args
2008-01-20 09:57:21adminlinkissue1090076 messages
2008-01-20 09:57:21admincreate