summaryrefslogtreecommitdiffstats
path: root/module/ConfigParser.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-08-07 15:26:52 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-08-07 15:26:52 +0200
commitfe1a7f4c91639588598c74a0c27a91192fbba78b (patch)
tree8c62519373956b1a621673375b706fd94dfa3d4c /module/ConfigParser.py
parentreconnect fix (diff)
downloadpyload-fe1a7f4c91639588598c74a0c27a91192fbba78b.tar.xz
hook improvements
Diffstat (limited to 'module/ConfigParser.py')
-rw-r--r--module/ConfigParser.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/module/ConfigParser.py b/module/ConfigParser.py
index 42dce1858..91396a83b 100644
--- a/module/ConfigParser.py
+++ b/module/ConfigParser.py
@@ -235,10 +235,13 @@ class ConfigParser:
#----------------------------------------------------------------------
def cast(self, typ, value):
"""cast value to given format"""
+ if type(value) not in (str, unicode):
+ return value
+
if typ == "int":
return int(value)
elif typ == "bool":
- return True if value.lower() in ("true", "on", "an","yes") else False
+ return True if value.lower() in ("1","true", "on", "an","yes") else False
else:
return value
@@ -278,6 +281,9 @@ class ConfigParser:
#----------------------------------------------------------------------
def set(self, section, option, value):
"""set value"""
+
+ value = self.cast(self.config[section][option]["type"], value)
+
self.config[section][option]["value"] = value
self.save()
@@ -289,6 +295,9 @@ class ConfigParser:
#----------------------------------------------------------------------
def setPlugin(self, plugin, option, value):
"""sets a value for a plugin"""
+
+ value = self.cast(self.plugin[plugin][option]["type"], value)
+
self.plugin[plugin][option]["value"] = value
self.save()