lxml - the Python XML toolkit

lxml.html.tostring() lacks essential with_tail option that lxml.etree.tostring() has

Reported by Jonathan Eunice on 2011-01-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Low
scoder

Bug Description

PROBLEM STATEMENT

lxml.etree.tostring() now has a with_tail option, but the parallel lxml.html.tostring() does not.

CODE SAMPLE

frag = lxml.html.fromstring('<p>This stuff is <em>really</em> great!</p>')
em = frag.cssselect('em').pop(0)
print lxml.etree.tostring(em, with_tail=False)
print lxml.html.tostring(em, with_tail=False)

fails on the last line with "TypeError: tostring() got an unexpected keyword argument 'with_tail' "

ENVIRONMENT TESTED

Python : sys.version_info(major=2, minor=7, micro=1, releaselevel='final', serial=0)
lxml.etree : (2, 3, -99, 0)
libxml used : (2, 7, 7)
libxml compiled : (2, 7, 7)
libxslt used : (1, 1, 26)

scoder (scoder) wrote :

What about providing a patch?

scoder (scoder) wrote :

Implemented here:

https://github.com/lxml/lxml/commit/d1f369f456106ad593dfb8a47fc6033a8234df29

Now, that wasn't all that hard, was it?

Changed in lxml:
assignee: nobody → Stefan Behnel (scoder)
importance: Undecided → Low
status: New → Fix Committed
scoder (scoder) wrote :

Fixed in lxml 2.3.3.

Changed in lxml:
status: Fix Committed → Fix Released
scoder (scoder) on 2013-04-28
Changed in lxml:
milestone: none → 2.3.x
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers