python3 compatibility
we only need to decode if the xml is bytes
This commit is contained in:
Ayub khan
2019-10-01 12:38:35 +05:00
parent 313183f3aa
commit 44b2414a5d

View File

@@ -119,7 +119,7 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
orig_name = orig_name[len(tag) + 1:-12]
# append the hash of the content--the first 12 bytes should be plenty.
orig_name = "_" + orig_name if orig_name not in (None, "") else ""
xml_bytes = xml.encode('utf8')
xml_bytes = xml if isinstance(xml, bytes) else xml.encode('utf-8')
return tag + orig_name + "_" + hashlib.sha1(xml_bytes).hexdigest()[:12]
# Fallback if there was nothing we could use: