mirror of
https://github.com/django/django.git
synced 2025-06-05 11:39:13 +00:00
Fixed a deprecation warning with the HTMLParser safe argument.
refs 6ca6c36f82b97eafeada61384b2e2f1d0587da86
This commit is contained in:
parent
306deab2c7
commit
dadf2ee75f
@ -3,6 +3,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
from django.utils.encoding import force_text, force_str
|
from django.utils.encoding import force_text, force_str
|
||||||
from django.utils.functional import allow_lazy
|
from django.utils.functional import allow_lazy
|
||||||
@ -118,10 +119,12 @@ linebreaks = allow_lazy(linebreaks, six.text_type)
|
|||||||
|
|
||||||
class MLStripper(HTMLParser):
|
class MLStripper(HTMLParser):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
if six.PY2:
|
# The strict parameter was added in Python 3.2 with a default of True.
|
||||||
HTMLParser.__init__(self)
|
# The default changed to False in Python 3.3 and was deprecated.
|
||||||
else:
|
if sys.version_info[:2] == (3, 2):
|
||||||
HTMLParser.__init__(self, strict=False)
|
HTMLParser.__init__(self, strict=False)
|
||||||
|
else:
|
||||||
|
HTMLParser.__init__(self)
|
||||||
self.reset()
|
self.reset()
|
||||||
self.fed = []
|
self.fed = []
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user