From d56fd050ced8c31eabae7a1ceabe8adaeec6b3bd Mon Sep 17 00:00:00 2001 From: mkaay Date: Tue, 30 Mar 2010 15:49:01 +0200 Subject: fixes #64 --- module/XMLConfigParser.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'module/XMLConfigParser.py') 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") -- cgit v1.2.3