From: Steinar H. Gunderson Date: Sun, 1 May 2011 11:15:51 +0000 (+0200) Subject: Allow the Python version to take in arbitrary list-like objects, such as generators... X-Git-Url: https://git.sesse.net/?p=xml-template;a=commitdiff_plain;h=c1cd6224b8614335bb04d36699876211843f558a Allow the Python version to take in arbitrary list-like objects, such as generators, where a list would be expected (iteration). Patch from Morten Minde Neergaard. --- diff --git a/python/xmltemplate.py b/python/xmltemplate.py index b24d764..182b8e4 100644 --- a/python/xmltemplate.py +++ b/python/xmltemplate.py @@ -63,7 +63,7 @@ def process(node, obj, clean = True): if not processed: process(child, obj, clean) - elif isinstance(obj, list): # repeat + elif hasattr(obj, '__iter__'): # repeat doc = _get_document_element(node) frag = doc.createElement("temporary-fragment") # ugh