This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kirpit
Recipients kirpit, ronaldoussoren
Date 2012-09-25.12:06:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1348574765.38.0.275058753456.issue16044@psf.upfronthosting.co.za>
In-reply-to
Content
xml.etree.ElementTree.Element's append method doesn't support iterator/sequence parameters as it's supposed to, for the version 1.3.0.

Python 2.7.3 (default, Sep 14 2012, 09:52:31) 
[GCC 4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.60))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.etree.ElementTree as et
>>> et.VERSION
'1.3.0'
>>> root = et.Element('root')
>>> sublist = [et.Element('sub'), et.Element('sub')]
>>> root.append(sublist)
>>> et.tostring(root)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1127, in tostring
    ElementTree(element).write(file, encoding, method=method)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 818, in write
    self._root, encoding, default_namespace
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 878, in _namespaces
    for elem in iterate():
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 477, in iter
    for e in e.iter(tag):
AttributeError: 'list' object has no attribute 'iter'

>>> root = et.Element('root')
>>> root.append(iter(sublist))
>>> et.tostring(root)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1127, in tostring
    ElementTree(element).write(file, encoding, method=method)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 818, in write
    self._root, encoding, default_namespace
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 878, in _namespaces
    for elem in iterate():
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 477, in iter
    for e in e.iter(tag):
AttributeError: 'listiterator' object has no attribute 'iter'
History
Date User Action Args
2012-09-25 12:06:05kirpitsetrecipients: + kirpit, ronaldoussoren
2012-09-25 12:06:05kirpitsetmessageid: <1348574765.38.0.275058753456.issue16044@psf.upfronthosting.co.za>
2012-09-25 12:06:04kirpitlinkissue16044 messages
2012-09-25 12:06:03kirpitcreate