1. Ronny Pfannschmidt
  2. py

Commits

Ronny Pfannschmidt  committed 117ea06

propperly handle lists in xmlgen on python3

  • Participants
  • Parent commits 2366418
  • Branches default

Comments (0)

Files changed (3)

File CHANGELOG

View file
  • Ignore whitespace
   about the eval magic of a decorator library
 - add py.builtin.next
 - iniconfig: add support for ; as comment starter
+- properly handle lists in xmlgen on python3
 
 Changes between 1.4.4 and 1.4.5
 ==================================================

File py/_xmlgen.py

View file
  • Ignore whitespace
     def list(self, obj):
         assert id(obj) not in self.visited
         self.visited[id(obj)] = 1
-        map(self.visit, obj)
+        for elem in obj:
+            self.visit(elem)
 
     def Tag(self, tag):
         assert id(tag) not in self.visited

File testing/root/test_xmlgen.py

View file
  • Ignore whitespace
     u = unicode(x)
     assert u == '<hello><world/></hello>'
 
+def test_list_nested():
+    x = ns.hello([ns.world()]) #pass in a list here
+    u = unicode(x)
+    assert u == '<hello><world/></hello>'
+
 def test_tag_xmlname():
     class my(ns.hello):
         xmlname = 'world'