summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTres Seaver <tseaver@palladion.com>2015-02-21 16:37:59 -0500
committerTres Seaver <tseaver@palladion.com>2015-02-21 16:37:59 -0500
commit755c2e01afec9cbfbebf3fc672f0d16fd7ea9266 (patch)
tree51970e0f23b1543c59aa356ba2cf1ab955043dea
parent26bf22464e5d19070c24820066e87895f5318f56 (diff)
downloadzope-tal-755c2e01afec9cbfbebf3fc672f0d16fd7ea9266.tar.gz
Suppress 'conver_charrefs' deprecation under Python 3.4.
Also, ensure that changed behavior in Python 3.5 won't affect us.
-rw-r--r--CHANGES.rst4
-rw-r--r--src/zope/tal/htmltalparser.py7
2 files changed, 9 insertions, 2 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index 5da59ee..616b20f 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,7 +4,9 @@ Changes
4.1.1 (unreleased)
------------------
-- TBD
+- Suppress deprecation under Python 3.4 for default ``convert_charrefs``
+ argument (passed to ``HTMLParser``). Also ensures that upcoming change
+ to the default in Python 3.5 will not affect us.
4.1.0 (2014-12-19)
diff --git a/src/zope/tal/htmltalparser.py b/src/zope/tal/htmltalparser.py
index cfa2952..46f36a5 100644
--- a/src/zope/tal/htmltalparser.py
+++ b/src/zope/tal/htmltalparser.py
@@ -27,6 +27,11 @@ from zope.tal.taldefs import (ZOPE_METAL_NS, ZOPE_TAL_NS, ZOPE_I18N_NS,
from zope.tal.talgenerator import TALGenerator
+_html_parser_extras = {}
+if 'convert_charrefs' in HTMLParser.__init__.__code__.co_names:
+ _html_parser_extras['convert_charrefs'] = False # pragma: NO COVER py34
+
+
BOOLEAN_HTML_ATTRS = frozenset([
# List of Boolean attributes in HTML that may be given in
# minimized form (e.g. <img ismap> rather than <img ismap="">)
@@ -107,7 +112,7 @@ class HTMLTALParser(HTMLParser):
# External API
def __init__(self, gen=None):
- HTMLParser.__init__(self)
+ HTMLParser.__init__(self, **_html_parser_extras)
if gen is None:
gen = TALGenerator(xml=0)
self.gen = gen