|
|
|
@ -2,7 +2,11 @@
|
|
|
|
|
BMConfigParser class definition and default configuration settings
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import ConfigParser
|
|
|
|
|
try:
|
|
|
|
|
import ConfigParser
|
|
|
|
|
except ModuleNotFoundError:
|
|
|
|
|
import configparser as ConfigParser
|
|
|
|
|
ConfigParser.SafeConfigParser = ConfigParser.ConfigParser
|
|
|
|
|
import os
|
|
|
|
|
import shutil
|
|
|
|
|
from datetime import datetime
|
|
|
|
@ -60,21 +64,33 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
|
|
|
|
|
raise ValueError("Invalid value %s" % value)
|
|
|
|
|
return ConfigParser.ConfigParser.set(self, section, option, value)
|
|
|
|
|
|
|
|
|
|
def get(self, section, option, raw=False, variables=None):
|
|
|
|
|
def get(self, section, option, raw=False, vars=None, fallback=None):
|
|
|
|
|
# pylint: disable=arguments-differ
|
|
|
|
|
try:
|
|
|
|
|
if section == "bitmessagesettings" and option == "timeformat":
|
|
|
|
|
return ConfigParser.ConfigParser.get(
|
|
|
|
|
self, section, option, raw, variables)
|
|
|
|
|
try:
|
|
|
|
|
return ConfigParser.ConfigParser.get(
|
|
|
|
|
self, section, option, raw=raw, vars=vars, fallback=fallback)
|
|
|
|
|
except TypeError:
|
|
|
|
|
return ConfigParser.ConfigParser.get(
|
|
|
|
|
self, section, option, raw=raw, vars=vars)
|
|
|
|
|
try:
|
|
|
|
|
return self._temp[section][option]
|
|
|
|
|
except KeyError:
|
|
|
|
|
pass
|
|
|
|
|
return ConfigParser.ConfigParser.get(
|
|
|
|
|
self, section, option, True, variables)
|
|
|
|
|
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:
|
|
|
|
|
return ConfigParser.ConfigParser.get(
|
|
|
|
|
self, section, option, True, variables)
|
|
|
|
|
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]
|
|
|
|
|