]> git.sesse.net Git - xml-template/blobdiff - python/xmltemplate.py
Implement alternate() in Python. All Python tests pass!
[xml-template] / 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):