diff options
author | Alexei Sorokin <[email protected]> | 2016-08-22 23:57:21 +0300 |
---|---|---|
committer | Alexei Sorokin <[email protected]> | 2016-08-23 18:01:15 +0300 |
commit | 5f116eb7aac88f1c308c12e57bfcc203ab44f309 (patch) | |
tree | a1eb78f413883edb673a8df0ce9be66da7c845a2 /Mozo | |
parent | 1c253ed41ff1f6f36173707d89070d36054db9f0 (diff) | |
download | mozo-5f116eb7aac88f1c308c12e57bfcc203ab44f309.tar.bz2 mozo-5f116eb7aac88f1c308c12e57bfcc203ab44f309.tar.xz |
fix minidom related crashes (#29)
Diffstat (limited to 'Mozo')
-rw-r--r-- | Mozo/MenuEditor.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Mozo/MenuEditor.py b/Mozo/MenuEditor.py index 512e7ef..8739d57 100644 --- a/Mozo/MenuEditor.py +++ b/Mozo/MenuEditor.py @@ -536,11 +536,19 @@ class MenuEditor: return found def __addXmlMenuElement(self, element, name, dom): + if isinstance(name, bytes): + name = name.decode('utf-8') + node = dom.createElement('Menu') self.__addXmlTextElement(node, 'Name', name, dom) return element.appendChild(node) def __addXmlTextElement(self, element, name, text, dom): + if isinstance(name, bytes): + name = name.decode('utf-8') + if isinstance(text, bytes): + text = text.decode('utf-8') + for temp in element.childNodes: if temp.nodeName == name: if temp.childNodes[0].nodeValue == text: @@ -551,6 +559,9 @@ class MenuEditor: return element.appendChild(node) def __addXmlFilename(self, element, dom, filename, type = 'Include'): + if isinstance(filename, bytes): + filename = filename.decode('utf-8') + # remove old filenames for node in self.__getXmlNodesByName(['Include', 'Exclude'], element): if node.childNodes[0].nodeName == 'Filename' and node.childNodes[0].childNodes[0].nodeValue == filename: |