lxml.builder.E doen't work with CDATA objects

Bug #1330525 reported by Ionel Cristian Mărieș
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
lxml
Fix Released
Low
scoder

Bug Description

>>> from lxml.builder import E
>>> from lxml.etree import CDATA
>>> E.stuff(CDATA('Some stuff that needs to be in a CDATA section'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ionel/dkiss/core/.ve/local/lib/python2.7/site-packages/lxml/builder.py", line 227, in __call__
    (type(item).__name__, item))
TypeError: bad argument type: CDATA(<lxml.etree.CDATA object at 0x7f5f531ff648>)

Would be nice if it would for without having to make a custom ElementBuilder.

# version information
>>> print("%-20s: %s" % ('Python', sys.version_info))
Python : sys.version_info(major=2, minor=7, micro=3, releaselevel='final', serial=0)
>>> print("%-20s: %s" % ('lxml.etree', etree.LXML_VERSION))
lxml.etree : (3, 3, 1, 0)
>>> print("%-20s: %s" % ('libxml used', etree.LIBXML_VERSION))
libxml used : (2, 7, 8)
>>> print("%-20s: %s" % ('libxml compiled', etree.LIBXML_COMPILED_VERSION))
libxml compiled : (2, 7, 8)
>>> print("%-20s: %s" % ('libxslt used', etree.LIBXSLT_VERSION))
libxslt used : (1, 1, 26)
>>> print("%-20s: %s" % ('libxslt compiled', etree.LIBXSLT_COMPILED_VERSION))
libxslt compiled : (1, 1, 26)

Revision history for this message
scoder (scoder) wrote :

Agreed. Should be easy to add, though. Want to give it a try? You can provide a pull request on github.

Changed in lxml:
assignee: nobody → scoder (scoder)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Ionel Cristian Mărieș (ionel-mc) wrote :
scoder (scoder)
Changed in lxml:
milestone: none → 3.4
status: Confirmed → Fix Committed
Revision history for this message
scoder (scoder) wrote :

Fix released in lxml 3.4.0.

Changed in lxml:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.