X-Git-Url: https://jfr.im/git/erebus.git/blobdiff_plain/c8a27fdb45843f49da91261529290d38d1751cc2..3cec5bdc665d310ac628e80b007dd2d71ae7d7bd:/config.py diff --git a/config.py b/config.py index fd8460a..9755f84 100644 --- a/config.py +++ b/config.py @@ -12,7 +12,7 @@ else: 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) @@ -60,8 +60,13 @@ class Config(object): 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', 'wb') as configfile: + with open(self.filename+'.tmp', 'w') as configfile: self.config.write(configfile) os.rename(configfile.name, self.filename)