2015-01-28 20:35:27 +08:00
|
|
|
from django.utils.six.moves import html_parser as _html_parser
|
|
|
|
|
2014-11-05 09:56:00 +08:00
|
|
|
try:
|
|
|
|
HTMLParseError = _html_parser.HTMLParseError
|
|
|
|
except AttributeError:
|
|
|
|
# create a dummy class for Python 3.5+ where it's been removed
|
|
|
|
class HTMLParseError(Exception):
|
|
|
|
pass
|
2012-07-20 22:16:57 +08:00
|
|
|
|
2012-02-01 04:36:11 +08:00
|
|
|
|
2016-12-01 18:38:01 +08:00
|
|
|
class HTMLParser(_html_parser.HTMLParser):
|
|
|
|
"""Explicitly set convert_charrefs to be False.
|
|
|
|
|
|
|
|
This silences a deprecation warning on Python 3.4, but we can't do
|
|
|
|
it at call time because Python 2.7 does not have the keyword
|
|
|
|
argument.
|
|
|
|
"""
|
|
|
|
def __init__(self, convert_charrefs=False, **kwargs):
|
|
|
|
_html_parser.HTMLParser.__init__(self, convert_charrefs=convert_charrefs, **kwargs)
|