[issue10387] ConfigParser's getboolean method is broken
Felix Laurie von Massenbach
report at bugs.python.org
Thu Nov 11 13:11:58 CET 2010
Felix Laurie von Massenbach <fantasizer at gmail.com> 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", "on"]
falses = ["0", "no", "false", "off"]
if result.lower() in trues:
return True
if result.lower() in falses:
return False
except AttributeError as err:
if str(err) == "\'bool\' object has no attribute \'lower\'":
return result
raise err
Felix
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10387>
_______________________________________
More information about the Python-bugs-list
mailing list