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.

classification
Title: ConfigParser converts option names to lower case on set()
Type: Stage:
Components: Extension Modules Versions: Python 2.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, mark-roberts, suslik
Priority: normal Keywords:

Created on 2006-09-05 18:35 by suslik, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg29770 - (view) Author: daniel (suslik) Date: 2006-09-05 18:35
Python 2.4.2 

Using set() in ConfigParser module converts all 
characters in option names to lower case.

To reproduce:

>>> import ConfigParser
>>> cfg = ConfigParser.ConfigParser()
>>> cfg.add_section('SectioN')
>>> cfg.set('SectioN','OpTiOn","ValuE')
>>> cfg.items('SectioN')
[('option', 'ValuE')]
msg29771 - (view) Author: Mark Roberts (mark-roberts) Date: 2006-09-06 03:30
Logged In: YES 
user_id=1591633

I can reproduce this on Win XP, Python 2.4, however, it
doesn't seem to be a bug.

In the docs
(http://docs.python.org/lib/module-ConfigParser.html), it
states that
"All option names used in interpolation will be passed
through the optionxform() method just like any other option
name reference. For example, using the default
implementation of optionxform() (which converts option names
to lower case), the values "foo %(bar)s" and "foo %(BAR)s"
are equivalent."

You might consider subclassing if this is an inconvenience
for you.
msg29772 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-09-06 05:53
Logged In: YES 
user_id=849994

Mark is correct. This is not a bug.
msg29773 - (view) Author: daniel (suslik) Date: 2006-09-13 18:55
Logged In: YES 
user_id=633916

Hmm, "broken" behavior by-design or not - it still makes it
impossible to use ConfigParser straight out in KDE, where
almost all option names are AaaaBbbbCccc.

I just went with a completely different parser.
http://wiki.python.org/moin/ConfigParserShootout
History
Date User Action Args
2022-04-11 14:56:20adminsetgithub: 43944
2006-09-05 18:35:31suslikcreate