summaryrefslogtreecommitdiffstats
path: root/module/XMLConfigParser.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2009-12-23 21:04:06 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2009-12-23 21:04:06 +0100
commit5ee3579572b60bb8f9e6475a517d69462b0cfe29 (patch)
tree7c3e26ad87bdaf10106bd1468b6e8f3c888e336e /module/XMLConfigParser.py
parentoops (diff)
downloadpyload-5ee3579572b60bb8f9e6475a517d69462b0cfe29.tar.xz
download speed limit
Diffstat (limited to 'module/XMLConfigParser.py')
-rw-r--r--module/XMLConfigParser.py10
1 files changed, 8 insertions, 2 deletions
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()