mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Make HTMLParser Python 3.5 ready
This commit is contained in:
parent
e50abb20b3
commit
8b299098c9
1 changed files with 5 additions and 1 deletions
|
|
@ -424,7 +424,11 @@ class _HTMLWordTruncator(HTMLParser):
|
||||||
def __init__(self, max_words):
|
def __init__(self, max_words):
|
||||||
# In Python 2, HTMLParser is not a new-style class,
|
# In Python 2, HTMLParser is not a new-style class,
|
||||||
# hence super() cannot be used.
|
# hence super() cannot be used.
|
||||||
HTMLParser.__init__(self)
|
try:
|
||||||
|
HTMLParser.__init__(self, convert_charrefs=False)
|
||||||
|
except TypeError:
|
||||||
|
# pre Python 3.3
|
||||||
|
HTMLParser.__init__(self)
|
||||||
|
|
||||||
self.max_words = max_words
|
self.max_words = max_words
|
||||||
self.words_found = 0
|
self.words_found = 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue