diff options
author | Alexei Sorokin <[email protected]> | 2016-08-22 23:57:21 +0300 |
---|---|---|
committer | Alexei Sorokin <[email protected]> | 2016-08-22 23:57:21 +0300 |
commit | 2256cf36835b904670606972fb4d6bb5f26ea5dc (patch) | |
tree | 0a11589db9e21f0e2f022f890731acb36e3282b5 /Mozo | |
parent | 97c5474bfa5c3a4d9f72dc8cba87d8e9ba79813f (diff) | |
download | mozo-2256cf36835b904670606972fb4d6bb5f26ea5dc.tar.bz2 mozo-2256cf36835b904670606972fb4d6bb5f26ea5dc.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 39776a3..0bc7cc4 100644 --- a/Mozo/MenuEditor.py +++ b/Mozo/MenuEditor.py @@ -530,11 +530,19 @@ class MenuEditor: return element 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: @@ -545,6 +553,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: |