[minor] html_utils.py, bleach.linkify remove tokenizer

This commit is contained in:
Rushabh Mehta 2017-03-09 14:02:26 +05:30
parent 70db4e7fc7
commit 2e1d0fe71e

View file

@ -24,15 +24,7 @@ def sanitize_html(html, linkify=False):
escaped_html = bleach.clean(html, tags=tags, attributes=attributes, styles=styles, strip_comments=strip_comments)
if linkify:
# based on bleach.clean
class s(bleach.BleachSanitizer):
allowed_elements = tags
allowed_attributes = attributes
allowed_css_properties = styles
strip_disallowed_elements = False
strip_html_comments = strip_comments
escaped_html = bleach.linkify(escaped_html, tokenizer=s)
escaped_html = bleach.linkify(escaped_html, callbacks=[])
return escaped_html