diff options
Diffstat (limited to 'config.py')
-rw-r--r-- | config.py | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -40,11 +40,25 @@ class _Configuration(object): self.configparser.set("settings", "category", value) def option_exists(self, option): - for section in self.configparser.sections(): + sections = self.configparser.sections() + for section in sections: if self.configparser.has_option(section, option): return True return False + def set_option(self, option, value): + sec = None + sections = self.configparser.sections() + for section in sections: + if self.configparser.has_option(section, option): + sec = section + + if not sec is None: + self.configparser.set(sec, option, value) + return True + else: + return False + def save(self): dirname = os.path.dirname(self.filename) if not os.path.exists(dirname): |