From 29ac21c98b9733ab9cb967cc5ae51aa9b23bed19 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Fri, 24 May 2013 21:44:02 +0200 Subject: added production / devel mode to webui --- module/config/ConfigManager.py | 10 ++++++---- module/config/default.py | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'module/config') diff --git a/module/config/ConfigManager.py b/module/config/ConfigManager.py index 85088020b..3290ed4ec 100644 --- a/module/config/ConfigManager.py +++ b/module/config/ConfigManager.py @@ -4,7 +4,7 @@ from new_collections import OrderedDict from module.Api import InvalidConfigSection -from module.utils import from_string, primary_uid, json +from module.utils import from_string, json from ConfigParser import ConfigParser @@ -60,8 +60,7 @@ class ConfigManager(ConfigParser): # Check if this config exists # Configs without meta data can not be loaded! data = self.config[section].config[option] - self.loadValues(user, section) - return self.values[user, section][option] + return self.loadValues(user, section)[option] except KeyError: pass # Returns default value later @@ -100,7 +99,10 @@ class ConfigManager(ConfigParser): return changed def saveValues(self, user, section): - self.db.saveConfig(section, json.dumps(self.values[user, section]), user) + if section in self.parser and user is None: + self.save() + elif (user, section) in self.values: + self.db.saveConfig(section, json.dumps(self.values[user, section]), user) def delete(self, section, user=None): """ Deletes values saved in db and cached values for given user, NOT meta data diff --git a/module/config/default.py b/module/config/default.py index dfa967284..8a2044281 100644 --- a/module/config/default.py +++ b/module/config/default.py @@ -67,6 +67,7 @@ def make_config(config): ("host", "ip", _("IP"), _("Tooltip"), "0.0.0.0"), ("https", "bool", _("Use HTTPS"), _("Tooltip"), False), ("port", "int", _("Port"), _("Tooltip"), 8001), + ("develop", "str", _("Development mode"), _(""), False), ]) config.addConfigSection("proxy", _("Proxy"), _("Description"), _("Long description"), -- cgit v1.2.3