@@ -46,6 +46,8 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
46
46
"""Singleton class inherited from ConfigParser.SafeConfigParser
47
47
with additional methods specific to bitmessage config."""
48
48
49
+ _temp = {}
50
+
49
51
def set (self , section , option , value = None ):
50
52
if self ._optcre is self .OPTCRE or value :
51
53
if not isinstance (value , basestring ):
@@ -59,6 +61,10 @@ def get(self, section, option, raw=False, variables=None):
59
61
if section == "bitmessagesettings" and option == "timeformat" :
60
62
return ConfigParser .ConfigParser .get (
61
63
self , section , option , raw , variables )
64
+ try :
65
+ return self ._temp [section ][option ]
66
+ except KeyError :
67
+ pass
62
68
return ConfigParser .ConfigParser .get (
63
69
self , section , option , True , variables )
64
70
except ConfigParser .InterpolationError :
@@ -70,6 +76,13 @@ def get(self, section, option, raw=False, variables=None):
70
76
except (KeyError , ValueError , AttributeError ):
71
77
raise e
72
78
79
+ def setTemp (self , section , option , value = None ):
80
+ """Temporary set option to value, not saving."""
81
+ try :
82
+ self ._temp [section ][option ] = value
83
+ except KeyError :
84
+ self ._temp [section ] = {option : value }
85
+
73
86
def safeGetBoolean (self , section , field ):
74
87
try :
75
88
return self .getboolean (section , field )
0 commit comments