home » zplus/freepost.git
Author zPlus <zplus@peers.community> 2023-06-17 04:12:08
Committer zPlus <zplus@peers.community> 2023-06-17 04:12:08
Commit fa6cb81 (patch)
Tree 576ca19
Parent(s)

Update bleach dependency. Change broken code from updated python3 "bleach" dependency.


commits diff: aada666..fa6cb81
1 file changed, 4 insertions, 3 deletionsdownload


Diffstat
-rw-r--r-- freepost/__init__.py 7

Diff options
View
Side
Whitespace
Context lines
Inter-hunk lines
+4/-3 M   freepost/__init__.py
index 3431014..a0bd7a5
old size: 27K - new size: 27K
@@ -37,8 +37,8 @@ template = functools.partial (
37 37 # TODO this should be renamed. It's only a way to pretty print dates
38 38 'title': lambda date: dateutil.parser.parse(date).strftime('%b %-d, %Y - %H:%M%z%Z'),
39 39 # Convert markdown to plain text
40 - 'md2txt': lambda text: bleach.clean (markdown.markdown (text),
41 - tags=[], attributes={}, styles=[], strip=True),
40 + 'md2txt': lambda text: bleach.clean (markdown.markdown(text),
41 + tags=[], attributes={}, strip=True),
42 42 # Convert markdown to html
43 43 'md2html': lambda text: bleach.clean (bleach.linkify (markdown.markdown (
44 44 text,
@@ -66,7 +66,8 @@ template = functools.partial (
66 66 # "bleach" library is used to sanitize the HTML output of jinja2's "md2html"
67 67 # filter. The library has only a very restrictive list of white-listed
68 68 # tags, so we add some more here.
69 - bleach.sanitizer.ALLOWED_TAGS += [ 'br', 'img', 'p', 'pre', 'h1', 'h2', 'h3', 'hr' ]
69 + # The list() casting is required because it's of type "frozenlist"
70 + bleach.sanitizer.ALLOWED_TAGS = list(bleach.sanitizer.ALLOWED_TAGS) + [ 'br', 'img', 'p', 'pre', 'h1', 'h2', 'h3', 'hr' ]
70 71 bleach.sanitizer.ALLOWED_ATTRIBUTES.update ({
71 72 'img': [ 'src' ]
72 73 })