From: sgunderson@bigfoot.com <> Date: Wed, 6 Sep 2006 15:59:54 +0000 (+0200) Subject: Fix a possible latent overwrite bug in the Python version. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=ff1a58ad618fd96e6991ccada77868d868db4252;p=xml-template Fix a possible latent overwrite bug in the Python version. --- diff --git a/python/xmltemplate.py b/python/xmltemplate.py index b134ae9..4cac815 100644 --- a/python/xmltemplate.py +++ b/python/xmltemplate.py @@ -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