-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update bleach to version >5.0.0 (#55)
* feat: Update bleach to version >5.0.0 * Feat: update testsuite to match tests for bleach>5.0.0 * Dep: update versions of dependency bleach * Docs: update docs for bleach>5.0.0 Co-authored-by: Laityned <diederik@digitalpatrol.nl>
- Loading branch information
Showing
14 changed files
with
152 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
from django.conf import settings | ||
|
||
from bleach.css_sanitizer import CSSSanitizer | ||
|
||
|
||
def get_bleach_default_options(): | ||
bleach_args = {} | ||
bleach_settings = { | ||
"BLEACH_ALLOWED_TAGS": "tags", | ||
"BLEACH_ALLOWED_ATTRIBUTES": "attributes", | ||
"BLEACH_ALLOWED_STYLES": "styles", | ||
"BLEACH_ALLOWED_STYLES": "css_sanitizer", | ||
"BLEACH_STRIP_TAGS": "strip", | ||
"BLEACH_STRIP_COMMENTS": "strip_comments", | ||
"BLEACH_ALLOWED_PROTOCOLS": "protocols" | ||
} | ||
|
||
for setting, kwarg in bleach_settings.items(): | ||
if hasattr(settings, setting): | ||
bleach_args[kwarg] = getattr(settings, setting) | ||
attr = getattr(settings, setting) | ||
if setting == "BLEACH_ALLOWED_STYLES": | ||
attr = CSSSanitizer(allowed_css_properties=attr) | ||
bleach_args[kwarg] = attr | ||
|
||
return bleach_args |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.