Switch configparser to raw mode
This commit is contained in:
parent
e647d70bbc
commit
df18f7b042
|
@ -1,7 +1,15 @@
|
||||||
from ConfigParser import SafeConfigParser
|
from ConfigParser import SafeConfigParser, ConfigParser
|
||||||
|
|
||||||
class BMConfigParser(SafeConfigParser):
|
class BMConfigParser(SafeConfigParser):
|
||||||
def set(self, section, option, value=None):
|
def set(self, section, option, value=None):
|
||||||
if value is not None:
|
if self._optcre is self.OPTCRE or value:
|
||||||
value = value.replace('%', '%%')
|
if not isinstance(value, basestring):
|
||||||
return SafeConfigParser.set(self, section, option, value)
|
raise TypeError("option values must be strings")
|
||||||
|
return ConfigParser.set(self, section, option, value)
|
||||||
|
|
||||||
|
def get(self, section, option, raw=False, vars=None):
|
||||||
|
return ConfigParser.get(self, section, option, True, vars)
|
||||||
|
|
||||||
|
def items(self, section, raw=False, vars=None):
|
||||||
|
return ConfigParser.items(self, section, True, vars)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user