diff options
author | mkaay <mkaay@mkaay.de> | 2010-03-30 15:49:01 +0200 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-03-30 15:49:01 +0200 |
commit | d56fd050ced8c31eabae7a1ceabe8adaeec6b3bd (patch) | |
tree | 8d6329b93957ca5848f01f76c69d107268f7ad18 /module/XMLConfigParser.py | |
parent | new server method (get_config) (diff) | |
download | pyload-d56fd050ced8c31eabae7a1ceabe8adaeec6b3bd.tar.xz |
fixes #64
Diffstat (limited to 'module/XMLConfigParser.py')
-rw-r--r-- | module/XMLConfigParser.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/module/XMLConfigParser.py b/module/XMLConfigParser.py index bde46afe5..0aede384c 100644 --- a/module/XMLConfigParser.py +++ b/module/XMLConfigParser.py @@ -70,11 +70,13 @@ class XMLConfigParser(): self.xml.writexml(fh) def _read_config(self): - def format(val): + def format(val, t="str"): if val.lower() == "true": return True elif val.lower() == "false": return False + elif t == "int": + return int(val) else: return val root = self.xml.documentElement @@ -92,8 +94,8 @@ class XMLConfigParser(): if opt.nodeType == opt.ELEMENT_NODE: data[section]["options"][opt.tagName] = {} try: - config[section][opt.tagName] = format(opt.firstChild.data) - data[section]["options"][opt.tagName]["value"] = format(opt.firstChild.data) + config[section][opt.tagName] = format(opt.firstChild.data, opt.getAttribute("type")) + data[section]["options"][opt.tagName]["value"] = format(opt.firstChild.data, opt.getAttribute("type")) except: config[section][opt.tagName] = "" data[section]["options"][opt.tagName]["name"] = opt.getAttribute("name") |