Use markupsafe.Markup instead of jinja2.Markup
authorMagnus Hagander <magnus@hagander.net>
Fri, 13 Dec 2024 12:57:40 +0000 (13:57 +0100)
committerMagnus Hagander <magnus@hagander.net>
Fri, 13 Dec 2024 12:57:40 +0000 (13:57 +0100)
This has been deprecated for a while and even before that (since 2.5) it
was just an alias, so switching our import should make no difference
other than working on jinja2 3.1.

postgresqleu/confreg/jinjafunc.py
tools/deploystatic/deploystatic.py

index bd303d7a5b12d4552615d0891888daf6c9476b2e..6a820afa20848f07a59910edd513d0275eb0261d 100644 (file)
@@ -24,6 +24,7 @@ from postgresqleu.util.templatetags import svgcharts
 from postgresqleu.util.templatetags.assets import do_render_asset
 from postgresqleu.util.messaging import get_messaging_class_from_typename
 
+import markupsafe
 import jinja2
 import jinja2.sandbox
 try:
@@ -319,7 +320,7 @@ extra_filters = {
     'timesince': timesince,
     'groupby_sort': filter_groupby_sort,
     'leadingnbsp': leadingnbsp,
-    'markdown': lambda t: jinja2.Markup(markdown.markdown(t, extensions=['tables', ])),
+    'markdown': lambda t: markupsafe.Markup(markdown.markdown(t, extensions=['tables', ])),
     'shuffle': filter_shuffle,
     'slugify': slugify,
     'yesno': lambda b, v: v.split(',')[not b],
index 682d327991be7d2398b4d0aa55088ef1a40eaaa3..fd37066e198db8331e30ad65540a7e6c1e2cfa3e 100755 (executable)
@@ -18,6 +18,7 @@ import subprocess
 import tarfile
 import copy
 
+import markupsafe
 import jinja2
 import jinja2.sandbox
 try:
@@ -98,7 +99,7 @@ global_filters = {
     'shuffle': filter_shuffle,
     'slugify': filter_slugify,
     'datetimeformat': filter_datetimeformat,
-    'markdown': lambda t: jinja2.Markup(markdown.markdown(t)),
+    'markdown': lambda t: markupsafe.Markup(markdown.markdown(t)),
     'social_links': filter_social_links,
 }