tag 654680 + patch thanks Hi Joerg (2012.01.05_10:39:33_+0200) > after python-html2text was upgraded to 3.200.1-1 the feeds read by > rss2email can't be parsed anymore
Looks like the html2text upstream didn't consider unescape() to be part of the public API, and moved it into a class-level function. https://github.com/aaronsw/html2text/commit/1a25828d556d30cc689c1bc2c11f52838c57b7ac I see it's also been marked with a "# @@nobody calls this function?" comment. Aaron: Are you intending to remove it? Joerg / Lindsey: The attached patch for rss2email should do the trick for supporting 3.200. The alternatives are: * re-adding a top level unescape() function to html2text, but that would have to create an HTML2Text object on each invocation... * Moving unscape() (and the functions it calls) back out of the class, but then HTML2Text.unicode_snob won't be very useful. SR -- Stefano Rivera http://tumbleweed.org.za/ H: +27 21 465 6908 C: +27 72 419 8559 UCT: x3127
--- a/rss2email.py +++ b/rss2email.py @@ -301,7 +301,7 @@ h2t.UNICODE_SNOB = UNICODE_SNOB h2t.LINKS_EACH_PARAGRAPH = LINKS_EACH_PARAGRAPH h2t.BODY_WIDTH = BODY_WIDTH -html2text = h2t.html2text +html2text = h2t.HTML2Text() from types import * @@ -381,7 +381,7 @@ if not HTMLOK: # Only need to convert to text if HTML isn't OK for c in conts: if contains(c.type, 'html'): - return html2text(c.value) + return html2text.handle(c.value) for c in conts: if c.type == 'text/plain': return c.value @@ -661,7 +661,7 @@ if 'title_detail' in entry and entry.title_detail: title = entry.title_detail.value if contains(entry.title_detail.type, 'html'): - title = html2text(title) + title = html2text.handle(title) else: title = getContent(entry)[:70] @@ -678,7 +678,7 @@ from_addr = getEmail(r, entry) - name = h2t.unescape(getName(r, entry)) + name = html2text.unescape(getName(r, entry)) fromhdr = formataddr((name, from_addr,)) tohdr = (f.to or default_to) subjecthdr = title
_______________________________________________ Python-modules-team mailing list Python-modules-team@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team