From: W. Trevor King Date: Sun, 14 Apr 2013 13:25:30 +0000 (-0400) Subject: feed: Use html.escape() instead of saxutils.escape() X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f74bc7b3d3c185ca72380cb1634f16a882536ba7;p=rss2email.git feed: Use html.escape() instead of saxutils.escape() html.escape() is new in Python 3.2 [1]. The effect is idential, but this makes more sense semantically as we are escaping the entities to use them in HTML, not in XML. [1]: http://docs.python.org/3.2/library/html.html#html.escape Signed-off-by: W. Trevor King --- diff --git a/rss2email/feed.py b/rss2email/feed.py index 378a2ea..c71f524 100644 --- a/rss2email/feed.py +++ b/rss2email/feed.py @@ -30,6 +30,7 @@ import collections as _collections from email.utils import formataddr as _formataddr import hashlib as _hashlib +import html as _html import html.parser as _html_parser import re as _re import socket as _socket @@ -37,7 +38,6 @@ import time as _time import urllib.error as _urllib_error import urllib.request as _urllib_request import xml.sax as _sax -import xml.sax.saxutils as _saxutils import feedparser as _feedparser import html2text as _html2text @@ -688,7 +688,7 @@ class Feed (object): if content['type'] in ('text/html', 'application/xhtml+xml'): lines.append(content['value'].strip()) else: - lines.append(_saxutils.escape(content['value'].strip())) + lines.append(_html.escape(content['value'].strip())) lines.append('') lines.extend([ '