Handle missing keyword in python2 configparser.

This commit is contained in:
Ilja Honkonen 2021-03-23 16:04:55 +02:00
parent a692c19faa
commit d5d3f7423f

View File

@ -74,11 +74,19 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
return self._temp[section][option]
except KeyError:
pass
try:
return ConfigParser.ConfigParser.get(
self, section, option, raw=True, vars=vars, fallback=fallback)
except TypeError:
return ConfigParser.ConfigParser.get(
self, section, option, raw=True, vars=vars)
except ConfigParser.InterpolationError:
try:
return ConfigParser.ConfigParser.get(
self, section, option, raw=True, vars=vars, fallback=fallback)
except TypeError:
return ConfigParser.ConfigParser.get(
self, section, option, raw=True, vars=vars)
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) as e:
try:
return BMConfigDefaults[section][option]