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 lukasz.langa
Recipients Felix.Laurie.von.Massenbach, lukasz.langa
Date 2010-11-11.13:12:38
SpamBayes Score 5.0785937e-10
Marked as misclassified No
Message-id <1289481160.12.0.659539657626.issue10387@psf.upfronthosting.co.za>
In-reply-to
Content
Felix, thanks for your report! :)

I believe you misunderstood that all ConfigParser objects by design should hold *only strings* inside. The same problem would appear if you tried to write() configuration from a parser with booleans or numbers to a file. You should convert values to strings before putting them on the parser.

This is a design deficiency in RawConfigParser that it allows setting values to other types. If you would use SafeConfigParser you'd see that it doesn't let assigning anything other than strings as option values.

As much as we would love straightening it out (ensuring that values must be strings in RawConfigParsers), we can't do that because of backwards compatibility concerns.

As for holding strings internally, this is a design decision that may look strange at first but when you look at it from the consistency perspective, it's better:  when you load values from an INI file parser can't tell whether some specific value should be considered boolean or a string. "yes" is a valid string and a valid boolean value for the parser. Which one to hold internally? We don't know. So we store strings and let the user decide when he's using get(). The same should happen when you put values into a parser on your own.

I hope that explains it.
History
Date User Action Args
2010-11-11 13:12:40lukasz.langasetrecipients: + lukasz.langa, Felix.Laurie.von.Massenbach
2010-11-11 13:12:40lukasz.langasetmessageid: <1289481160.12.0.659539657626.issue10387@psf.upfronthosting.co.za>
2010-11-11 13:12:38lukasz.langalinkissue10387 messages
2010-11-11 13:12:38lukasz.langacreate