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

Bug #697961 reported by Jonathan Eunice
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Fix Released
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)

Revision history for this message
scoder (scoder) wrote :

What about providing a patch?

Revision history for this message
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
Revision history for this message
scoder (scoder) wrote :

Fixed in lxml 2.3.3.

Changed in lxml:
status: Fix Committed → Fix Released
scoder (scoder)
Changed in lxml:
milestone: none → 2.3.x
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.