From 5ee3579572b60bb8f9e6475a517d69462b0cfe29 Mon Sep 17 00:00:00 2001 From: mkaay Date: Wed, 23 Dec 2009 21:04:06 +0100 Subject: download speed limit --- module/XMLConfigParser.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'module/XMLConfigParser.py') diff --git a/module/XMLConfigParser.py b/module/XMLConfigParser.py index b46f9c959..51741fdfd 100644 --- a/module/XMLConfigParser.py +++ b/module/XMLConfigParser.py @@ -17,18 +17,24 @@ """ from __future__ import with_statement +from os.path import exists + from xml.dom.minidom import parse class XMLConfigParser(): - def __init__(self, data): + def __init__(self, data, default_data=None): self.xml = None self.file = data + self.file_default = default_data self.config = {} self.loadData() self.root = None def loadData(self): - with open(self.file, 'r') as fh: + file = self.file + if not exists(self.file): + file = self.file_default + with open(file, 'r') as fh: self.xml = parse(fh) self._read_config() -- cgit v1.2.3