Add safeGetInt to BMConfigParser

master
Peter Šurda 6 years ago
parent 02a7c59de8
commit bcc7692e14
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

@ -27,6 +27,14 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
return False
return False
def safeGetInt(self, section, field):
if self.has_option(section, field):
try:
return self.getint(section, field)
except ValueError:
return 0
return 0
def safeGet(self, section, option, default = None):
if self.has_option(section, option):
return self.get(section, option)

Loading…
Cancel
Save