2016-12-06 13:04:52 +01:00
|
|
|
import ConfigParser
|
2016-12-06 10:47:39 +01:00
|
|
|
|
2016-12-06 13:04:52 +01:00
|
|
|
class BMConfigParser(ConfigParser.SafeConfigParser):
|
2016-12-06 10:47:39 +01:00
|
|
|
def set(self, section, option, value=None):
|
2016-12-06 11:01:17 +01:00
|
|
|
if self._optcre is self.OPTCRE or value:
|
|
|
|
if not isinstance(value, basestring):
|
|
|
|
raise TypeError("option values must be strings")
|
2016-12-06 13:04:52 +01:00
|
|
|
return ConfigParser.ConfigParser.set(self, section, option, value)
|
2016-12-06 11:01:17 +01:00
|
|
|
|
|
|
|
def get(self, section, option, raw=False, vars=None):
|
2016-12-06 13:04:52 +01:00
|
|
|
if section == "bitmessagesettings" and option == "timeformat":
|
|
|
|
try:
|
|
|
|
return ConfigParser.ConfigParser.get(self, section, option, raw, vars)
|
|
|
|
except ConfigParser.InterpolationError:
|
|
|
|
return ConfigParser.ConfigParser.get(self, section, option, True, vars)
|
|
|
|
return ConfigParser.ConfigParser.get(self, section, option, True, vars)
|
2016-12-06 11:01:17 +01:00
|
|
|
|
|
|
|
def items(self, section, raw=False, vars=None):
|
2016-12-06 13:04:52 +01:00
|
|
|
return ConfigParser.ConfigParser.items(self, section, True, vars)
|
2016-12-06 11:01:17 +01:00
|
|
|
|