]> git.sesse.net Git - xml-template/blobdiff - python/xmltemplate.py
Update the PHP SWIG version to PHP 7, with various crash fixes, too.
[xml-template] / python / xmltemplate.py
index 182b8e4a3712953d48a572d4183791ef4c3946ea..434868703e1d014c36525b0feaab72ae087dea7f 100644 (file)
@@ -1,14 +1,21 @@
 #! /usr/bin/python
 import re
+import sys
 import xml.dom.minidom
 
+if sys.version_info[0] > 2:
+    string = str
+else:
+    string = basestring
+
+
 def process_file(filename, obj, clean = True):
        doc = xml.dom.minidom.parse(filename)
        process(doc, obj, clean)
        return doc
 
 def process(node, obj, clean = True):
-       if isinstance(obj, basestring):                 # overwrite
+       if isinstance(obj, string):                     # overwrite
                while not node.firstChild is None:
                        node.removeChild(node.firstChild)
                doc = _get_document_element(node)