Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed a deprecation warning with the HTMLParser safe argument.

refs 6ca6c36
  • Loading branch information...
commit dadf2ee75f88653b94b9c05a3118fd1590853e77 1 parent 306deab
@timgraham timgraham authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 django/utils/html.py
View
9 django/utils/html.py
@@ -3,6 +3,7 @@
from __future__ import unicode_literals
import re
+import sys
from django.utils.encoding import force_text, force_str
from django.utils.functional import allow_lazy
@@ -118,10 +119,12 @@ def linebreaks(value, autoescape=False):
class MLStripper(HTMLParser):
def __init__(self):
- if six.PY2:
- HTMLParser.__init__(self)
- else:
+ # The strict parameter was added in Python 3.2 with a default of True.
+ # The default changed to False in Python 3.3 and was deprecated.
+ if sys.version_info[:2] == (3, 2):
HTMLParser.__init__(self, strict=False)
+ else:
+ HTMLParser.__init__(self)
self.reset()
self.fed = []
Please sign in to comment.
Something went wrong with that request. Please try again.