summaryrefslogtreecommitdiffstats
path: root/module/config/ConfigManager.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-25 19:12:39 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-25 19:12:39 +0100
commitb5f66789e70bd105e162470927942c40496cdc92 (patch)
tree3a762f29008dd7d7c92221eb363f90580f8acb6f /module/config/ConfigManager.py
parentadded view type for input fields (diff)
downloadpyload-b5f66789e70bd105e162470927942c40496cdc92.tar.xz
simple rendering for settings page
Diffstat (limited to 'module/config/ConfigManager.py')
-rw-r--r--module/config/ConfigManager.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/module/config/ConfigManager.py b/module/config/ConfigManager.py
index 8d908abaf..ff638fd71 100644
--- a/module/config/ConfigManager.py
+++ b/module/config/ConfigManager.py
@@ -42,6 +42,7 @@ class ConfigManager(ConfigParser):
# Entries are saved as (user, section) keys
self.values = {}
# TODO: similar to a cache, could be deleted periodically
+ # TODO: user / primaryuid is a bit messy
def save(self):
self.parser.save()
@@ -78,6 +79,8 @@ class ConfigManager(ConfigParser):
self.values[user, section] = {}
self.core.print_exc()
+ return self.values[user, section]
+
@convertKeyError
def set(self, section, option, value, sync=True, user=None):
""" set config value """
@@ -107,7 +110,7 @@ class ConfigManager(ConfigParser):
def delete(self, section, user=False):
""" Deletes values saved in db and cached values for given user, NOT meta data
Does not trigger an error when nothing was deleted. """
- user = user.primary if user else None
+ user = primary_uid(user)
if (user, section) in self.values:
del self.values[user, section]
@@ -132,3 +135,10 @@ class ConfigManager(ConfigParser):
for name, config in self.config.iteritems():
yield name, config, values[name] if name in values else {}
+
+ def getSection(self, section, user=None):
+ if section in self.parser and primary_uid(user) is None:
+ return self.parser.getSection(section)
+
+ values = self.loadValues(section, user)
+ return self.config.get(section), values