fix: Prepare for the bleach 6.0.0 upgrad.
Changelog: https://bleach.readthedocs.io/en/latest/changes.html#version-6-0-0-january-23rd-2023 The major change is that the tags and protocols attributes and related constants are expected to be sets rather than lists.
This commit is contained in:
@@ -191,8 +191,8 @@ def sanitize_html(html_code):
|
||||
})
|
||||
output = bleach.clean(
|
||||
html_code,
|
||||
protocols=bleach.ALLOWED_PROTOCOLS + ['data'],
|
||||
tags=bleach.ALLOWED_TAGS + ['div', 'p', 'audio', 'pre', 'img', 'span'],
|
||||
protocols=bleach.ALLOWED_PROTOCOLS | {'data'},
|
||||
tags=bleach.ALLOWED_TAGS | {'div', 'p', 'audio', 'pre', 'img', 'span'},
|
||||
css_sanitizer=CSSSanitizer(allowed_css_properties=["white-space"]),
|
||||
attributes=attributes
|
||||
)
|
||||
@@ -216,12 +216,12 @@ def remove_markup(html):
|
||||
"""
|
||||
Return html with markup stripped and text HTML-escaped.
|
||||
|
||||
>>> bleach.clean("<b>Rock & Roll</b>", tags=[], strip=True)
|
||||
>>> bleach.clean("<b>Rock & Roll</b>", tags=set(), strip=True)
|
||||
'Rock & Roll'
|
||||
>>> bleach.clean("<b>Rock & Roll</b>", tags=[], strip=True)
|
||||
>>> bleach.clean("<b>Rock & Roll</b>", tags=set(), strip=True)
|
||||
'Rock & Roll'
|
||||
"""
|
||||
return HTML(bleach.clean(html, tags=[], strip=True))
|
||||
return HTML(bleach.clean(html, tags=set(), strip=True))
|
||||
|
||||
|
||||
def get_course_id_from_capa_block(capa_block):
|
||||
|
||||
Reference in New Issue
Block a user