Ensure that pgAdmin4 should work with latest jinja2 version. Fixes #7269

This commit is contained in:
Nikhil Mohite
2022-03-25 11:52:11 +05:30
committed by Akshay Joshi
parent 0b4a874f30
commit 04d0ab4adf
2 changed files with 3 additions and 1 deletions

View File

@@ -26,3 +26,4 @@ Bug fixes
| `Issue #7257 <https://redmine.postgresql.org/issues/7257>`_ - Support running the container under OpenShift with alternate UIDs. | `Issue #7257 <https://redmine.postgresql.org/issues/7257>`_ - Support running the container under OpenShift with alternate UIDs.
| `Issue #7261 <https://redmine.postgresql.org/issues/7261>`_ - Correct typo in the documentation. | `Issue #7261 <https://redmine.postgresql.org/issues/7261>`_ - Correct typo in the documentation.
| `Issue #7267 <https://redmine.postgresql.org/issues/7267>`_ - Fixed an issue where unexpected error messages are displayed when users change the language via preferences. | `Issue #7267 <https://redmine.postgresql.org/issues/7267>`_ - Fixed an issue where unexpected error messages are displayed when users change the language via preferences.
| `Issue #7269 <https://redmine.postgresql.org/issues/7269>`_ - Ensure that pgAdmin4 should work with latest jinja2 version.

View File

@@ -33,6 +33,7 @@ from flask_security.utils import login_user, logout_user
from werkzeug.datastructures import ImmutableDict from werkzeug.datastructures import ImmutableDict
from werkzeug.local import LocalProxy from werkzeug.local import LocalProxy
from werkzeug.utils import find_modules from werkzeug.utils import find_modules
from jinja2 import select_autoescape
from pgadmin.model import db, Role, Server, SharedServer, ServerGroup, \ from pgadmin.model import db, Role, Server, SharedServer, ServerGroup, \
User, Keys, Version, SCHEMA_VERSION as CURRENT_SCHEMA_VERSION User, Keys, Version, SCHEMA_VERSION as CURRENT_SCHEMA_VERSION
@@ -70,7 +71,7 @@ class PgAdmin(Flask):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
# Set the template loader to a postgres-version-aware loader # Set the template loader to a postgres-version-aware loader
self.jinja_options = ImmutableDict( self.jinja_options = ImmutableDict(
extensions=['jinja2.ext.autoescape', 'jinja2.ext.with_'], autoescape=select_autoescape(enabled_extensions=('html', 'xml')),
loader=VersionedTemplateLoader(self) loader=VersionedTemplateLoader(self)
) )
self.logout_hooks = [] self.logout_hooks = []