diff options
-rw-r--r-- | CHANGES.rst | 4 | ||||
-rw-r--r-- | src/zope/tal/htmltalparser.py | 7 |
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 |