]> git.sesse.net Git - xml-template/commitdiff
Implement alternate() in Python. All Python tests pass!
authorsgunderson@bigfoot.com <>
Wed, 6 Sep 2006 16:04:33 +0000 (18:04 +0200)
committersgunderson@bigfoot.com <>
Wed, 6 Sep 2006 16:04:33 +0000 (18:04 +0200)
python/xmltemplate.py

index 786ad01337dc9cd407f212c6c2c37bca14fdf051..6b9c50b65d2f035e45617b07f874c24d400eccf1 100644 (file)
@@ -89,6 +89,11 @@ def process(node, obj, clean = True):
                _clean(node)
 
 def alternate(tag, array, *elems):
+       i = 0
+       for ref in array:
+               ref[tag] = elems[i % len(elems)]
+               i = i + 1
+               
        return array
 
 def _clean(node):