fixed remaining methods in HTMLParser that were still using the old htmllib.HTMLParser interface
This commit is contained in:
+2
-9
@@ -97,8 +97,7 @@ class XssCleaner(HTMLParser):
|
|||||||
def handle_starttag(
|
def handle_starttag(
|
||||||
self,
|
self,
|
||||||
tag,
|
tag,
|
||||||
method,
|
attrs
|
||||||
attrs,
|
|
||||||
):
|
):
|
||||||
if tag not in self.permitted_tags:
|
if tag not in self.permitted_tags:
|
||||||
if self.strip_disallowed:
|
if self.strip_disallowed:
|
||||||
@@ -128,7 +127,7 @@ class XssCleaner(HTMLParser):
|
|||||||
self.result += bt
|
self.result += bt
|
||||||
self.open_tags.insert(0, tag)
|
self.open_tags.insert(0, tag)
|
||||||
|
|
||||||
def handle_endtag(self, tag, attrs):
|
def handle_endtag(self, tag):
|
||||||
bracketed = '</%s>' % tag
|
bracketed = '</%s>' % tag
|
||||||
if tag not in self.permitted_tags:
|
if tag not in self.permitted_tags:
|
||||||
if self.strip_disallowed:
|
if self.strip_disallowed:
|
||||||
@@ -139,12 +138,6 @@ class XssCleaner(HTMLParser):
|
|||||||
self.result += bracketed
|
self.result += bracketed
|
||||||
self.open_tags.remove(tag)
|
self.open_tags.remove(tag)
|
||||||
|
|
||||||
def unknown_starttag(self, tag, attributes):
|
|
||||||
self.handle_starttag(tag, None, attributes)
|
|
||||||
|
|
||||||
def unknown_endtag(self, tag):
|
|
||||||
self.handle_endtag(tag, None)
|
|
||||||
|
|
||||||
def url_is_acceptable(self, url):
|
def url_is_acceptable(self, url):
|
||||||
"""
|
"""
|
||||||
Accepts relative, absolute, and mailto urls
|
Accepts relative, absolute, and mailto urls
|
||||||
|
|||||||
Reference in New Issue
Block a user