Revert "Remove deprecated jinja2 references"

This reverts commit 31bf876f81.
pull/8292/head
Matt Westcott 2022-04-06 12:35:46 +01:00
rodzic 4cdac49533
commit 957c6fe15c
6 zmienionych plików z 8 dodań i 11 usunięć

Wyświetl plik

@ -4,7 +4,6 @@ Changelog
2.16.2 (xx.xx.xxxx) - IN DEVELOPMENT
~~~~~~~~~~~~~~~~~~~
* Update Jinja2 template support for Jinja2 3.x (Seb Brown)
* Fix: Update django-treebeard dependency to 4.5.1 or above (Serafeim Papastefanos)
* Fix: Fix permission error when sorting pages having page type restrictions (Thijs Kramer)
* Fix: Allow bulk publishing of pages without revisions (Andy Chosak)

Wyświetl plik

@ -11,6 +11,5 @@
### Bug fixes
* Update django-treebeard dependency to 4.5.1 or above (Serafeim Papastefanos)
* Update Jinja2 template support for Jinja2 3.x (Seb Brown)
* Fix permission error when sorting pages having page type restrictions (Thijs Kramer)
* Allow bulk publishing of pages without revisions (Andy Chosak)

Wyświetl plik

@ -45,7 +45,7 @@ testing_extras = [
'python-dateutil>=2.7',
'pytz>=2014.7',
'elasticsearch>=5.0,<6.0',
'Jinja2>=3.0,<3.2',
'Jinja2>=3.0,<4.0',
'boto3>=1.16,<1.17',
'freezegun>=0.3.8',
'openpyxl>=2.6.4',

Wyświetl plik

@ -10,7 +10,7 @@ class WagtailUserbarExtension(Extension):
super().__init__(environment)
self.environment.globals.update({
"wagtailuserbar": jinja2.pass_context(wagtailuserbar),
'wagtailuserbar': jinja2.contextfunction(wagtailuserbar),
})

Wyświetl plik

@ -57,7 +57,7 @@ class SiteSettings(dict):
return out
@jinja2.pass_context
@jinja2.contextfunction
def get_setting(context, model_string, use_default_site=False):
if use_default_site:
site = Site.objects.get(is_default_site=True)

Wyświetl plik

@ -2,7 +2,6 @@ import jinja2
import jinja2.nodes
from jinja2.ext import Extension
from markupsafe import Markup, escape
from .templatetags.wagtailcore_tags import pageurl, richtext, slugurl, wagtail_site, wagtail_version
@ -14,9 +13,9 @@ class WagtailCoreExtension(Extension):
super().__init__(environment)
self.environment.globals.update({
'pageurl': jinja2.pass_context(pageurl),
'slugurl': jinja2.pass_context(slugurl),
'wagtail_site': jinja2.pass_context(wagtail_site),
'pageurl': jinja2.contextfunction(pageurl),
'slugurl': jinja2.contextfunction(slugurl),
'wagtail_site': jinja2.contextfunction(wagtail_site),
'wagtail_version': wagtail_version,
})
self.environment.filters.update({
@ -63,9 +62,9 @@ class WagtailCoreExtension(Extension):
result = value
if context.eval_ctx.autoescape:
return escape(result)
return jinja2.escape(result)
else:
return Markup(result)
return jinja2.Markup(result)
# Nicer import names