class Config(object):
def __init__(self, filename, writeout=True):
- self.__dict__['config'] = ConfigParser.RawConfigParser()
+ self.__dict__['config'] = ConfigParser.RawConfigParser(delimiters=('=',))
self.__dict__['filename'] = filename
self.__dict__['writeout'] = writeout
self.config.read(filename)
self.config.set(section, key, str(value))
if self.writeout: self.write()
+ def delete(self, section, key):
+ if self.config.has_section(section):
+ self.config.remove_option(section, key)
+ if self.writeout: self.write()
+
def write(self):
with open(self.filename+'.tmp', 'w') as configfile:
self.config.write(configfile)