Skip to content

Commit a1abf71

Browse files
Drew HublCaptainCodeman
Drew Hubl
authored andcommitted
Use six to import urlparse
1 parent 5210af7 commit a1abf71

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

html5lib/sanitizer.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
import re
44
from xml.sax.saxutils import escape, unescape
5-
try:
6-
from urllib.parse import urlparse
7-
except ImportError:
8-
from urlparse import urlparse
5+
from six.moves import urllib_parse as urlparse
96

107
from .tokenizer import HTMLTokenizer
118
from .constants import tokenTypes
@@ -196,7 +193,7 @@ def allowed_token(self, token, token_type):
196193
unescape(attrs[attr])).lower()
197194
# remove replacement characters from unescaped characters
198195
val_unescaped = val_unescaped.replace("\ufffd", "")
199-
uri = urlparse(val_unescaped)
196+
uri = urlparse.urlparse(val_unescaped)
200197
if uri:
201198
if uri.scheme not in self.allowed_protocols:
202199
del attrs[attr]

0 commit comments

Comments
 (0)