]> git.sesse.net Git - xml-template/commitdiff
Fix a possible latent overwrite bug in the Python version.
authorsgunderson@bigfoot.com <>
Wed, 6 Sep 2006 15:59:54 +0000 (17:59 +0200)
committersgunderson@bigfoot.com <>
Wed, 6 Sep 2006 15:59:54 +0000 (17:59 +0200)
python/xmltemplate.py

index b134ae9ffba21c3c114f5f93cb53d80907043778..4cac815ae1ffc99d3fc739039d303379037c4f6b 100644 (file)
@@ -9,8 +9,8 @@ def process_file(filename, obj, clean = True):
 
 def process(node, obj, clean = True):
        if isinstance(obj, str):                        # overwrite
-               for child in node.childNodes:
-                       node.removeChild(child)
+               while not node.firstChild is None:
+                       node.removeChild(node.firstChild)
                doc = _get_document_element(node)
                node.appendChild(doc.createTextNode(obj))
        elif isinstance(obj, xml.dom.Node):             # overwrite