From: Magnus Hagander Date: Fri, 13 Dec 2024 12:57:40 +0000 (+0100) Subject: Use markupsafe.Markup instead of jinja2.Markup X-Git-Url: http://git.postgresql.org/gitweb/static/%7B%7Bpguslink%28?a=commitdiff_plain;h=d3735cc897a3157917b7044056dff0a8fbc243b3;p=pgeu-system.git Use markupsafe.Markup instead of jinja2.Markup 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. --- diff --git a/postgresqleu/confreg/jinjafunc.py b/postgresqleu/confreg/jinjafunc.py index bd303d7a..6a820afa 100644 --- a/postgresqleu/confreg/jinjafunc.py +++ b/postgresqleu/confreg/jinjafunc.py @@ -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], diff --git a/tools/deploystatic/deploystatic.py b/tools/deploystatic/deploystatic.py index 682d3279..fd37066e 100755 --- a/tools/deploystatic/deploystatic.py +++ b/tools/deploystatic/deploystatic.py @@ -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, }