diff options
Diffstat (limited to 'module/XMLConfigParser.py')
-rw-r--r-- | module/XMLConfigParser.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/module/XMLConfigParser.py b/module/XMLConfigParser.py index 678338b41..8be2df048 100644 --- a/module/XMLConfigParser.py +++ b/module/XMLConfigParser.py @@ -131,11 +131,30 @@ class XMLConfigParser(): self._setAttributes(section, data) self.saveData() self.loadData() + + def remove(self, section, option): + root = self.root + for node in root.childNodes: + if node.nodeType == node.ELEMENT_NODE: + if section == node.tagName: + for opt in node.childNodes: + if opt.nodeType == opt.ELEMENT_NODE: + if option == opt.tagName: + node.removeChild(opt) + self.saveData() + return + def _setAttributes(self, node, data): option = self.root.getElementsByTagName(node)[0].getElementsByTagName(data["option"])[0] - option.setAttribute("name", data["name"]) - option.setAttribute("type", data["type"]) + try: + option.setAttribute("name", data["name"]) + except: + pass + try: + option.setAttribute("type", data["type"]) + except: + pass try: option.setAttribute("input", data["input"]) except: |