[issue10387] ConfigParser's getboolean method is broken

2010-11-13 Thread Senthil Kumaran
Senthil Kumaran added the comment: On Sat, Nov 13, 2010 at 01:20:45AM +, Łukasz Langa wrote: > You think wrong. Try it. Okay, I get it. Coercing would be a bad idea in RawConfigParser because there are cases where get method can have raw=True and coercing would break those behaviors. The w

[issue10387] ConfigParser's getboolean method is broken

2010-11-12 Thread Łukasz Langa
Łukasz Langa added the comment: You think wrong. Try it. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue10387] ConfigParser's getboolean method is broken

2010-11-12 Thread Senthil Kumaran
Senthil Kumaran added the comment: On Fri, Nov 12, 2010 at 12:35:49AM +, Łukasz Langa wrote: > This is unfortunately a backwards compatibility concern. Originally > it wasn't made so that set() converts to string or accepts only > strings and when the developers realized this mistake, it was

[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Łukasz Langa
Changes by Łukasz Langa : -- status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail

[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Łukasz Langa
Łukasz Langa added the comment: This is unfortunately a backwards compatibility concern. Originally it wasn't made so that set() converts to string or accepts only strings and when the developers realized this mistake, it was too late (there were programs using this misfeature). That's one of

[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Felix Laurie von Massenbach
Felix Laurie von Massenbach added the comment: Ok, so I understand the issue, but why doesn't the set method simply convert to a string? >>> from ConfigParser import RawConfigParser >>> from StringIO import StringIO >>> parser = RawConfigParser() >>> config = """ [section] test = True """ >>>

[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Éric Araujo
Changes by Éric Araujo : -- components: +Library (Lib) -Extension Modules stage: -> unit test needed ___ Python tracker ___ ___ Pytho

[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Éric Araujo
Changes by Éric Araujo : -- nosy: +eric.araujo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Łukasz Langa
Łukasz Langa added the comment: No problem Felix. But look: Python 2.7 (r27:82500, Sep 24 2010, 12:26:28) [GCC 4.3.4 20090804 (release) 1] on cygwin Type "help", "copyright", "credits" or "license" for more information. >>> config = """ ... [section] ... does_it_work = True ... is_it_broken = F

[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Felix Laurie von Massenbach
Felix Laurie von Massenbach added the comment: Perhaps I don't understand fully, but I am reading, for example, "option = True" from a config file. When doing this getboolean raises: AttributeError: 'bool' object has no attribute 'lower' Is it intended that you cannot store "True" and "False"

[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Łukasz Langa
Łukasz Langa added the comment: 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 sh

[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Georg Brandl
Changes by Georg Brandl : -- assignee: -> lukasz.langa nosy: +lukasz.langa ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Felix Laurie von Massenbach
Felix Laurie von Massenbach added the comment: Oops, that was the broken first version. Let's try again: class MyConfigParser(ConfigParser.RawConfigParser): def getboolean(self, section, option): result = self.get(section, option) try: trues = ["1", "yes", "true"

[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Felix Laurie von Massenbach
New submission from Felix Laurie von Massenbach : If the config file has a boolean formatted as either True or False, python raises an attribute error when doing str.lower() on it. In my code I've worked around this in the following way: class MyConfigParser(ConfigParser.RawConfigParser):