Message120943
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):
def getboolean(self, section, option):
result = self.get(section, option)
try:
trues = ["1", "yes", "true", "on"]
falses = ["0", "no", "false", "off"]
if result in trues:
return True
if result in falses:
return False
except AttributeError as err:
if str(err) == "\'bool\' object has no attribute \'lower\'":
return result
raise err
Felix
(p.s. first bug report, sorry if it's a bit of a mess...) |
|
Date |
User |
Action |
Args |
2010-11-11 12:06:24 | Felix.Laurie.von.Massenbach | set | recipients:
+ Felix.Laurie.von.Massenbach |
2010-11-11 12:06:24 | Felix.Laurie.von.Massenbach | set | messageid: <1289477184.84.0.648837356177.issue10387@psf.upfronthosting.co.za> |
2010-11-11 12:06:20 | Felix.Laurie.von.Massenbach | link | issue10387 messages |
2010-11-11 12:06:20 | Felix.Laurie.von.Massenbach | create | |
|