From: David Lord Date: Tue, 9 Nov 2021 20:44:30 +0000 (-0800) Subject: remove deprecated Markup and escape aliases X-Git-Tag: 3.1.0~22^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=824b4d3e5bb789cabd7cef74e57f4d802a7b2bfd;p=thirdparty%2Fjinja.git remove deprecated Markup and escape aliases --- diff --git a/CHANGES.rst b/CHANGES.rst index 5bb8e9f9..35dcd78e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,6 +14,7 @@ Unreleased ``evalcontextfunction`` are replaced by ``pass_eval_context``. ``environmentfilter`` and ``environmentfunction`` are replaced by ``pass_environment``. + - ``Markup`` and ``escape`` should be imported from MarkupSafe. Version 3.0.3 diff --git a/src/jinja2/__init__.py b/src/jinja2/__init__.py index ebac1768..f2499c7f 100644 --- a/src/jinja2/__init__.py +++ b/src/jinja2/__init__.py @@ -28,9 +28,7 @@ from .runtime import make_logging_undefined as make_logging_undefined from .runtime import StrictUndefined as StrictUndefined from .runtime import Undefined as Undefined from .utils import clear_caches as clear_caches -from .utils import escape from .utils import is_undefined as is_undefined -from .utils import Markup from .utils import pass_context as pass_context from .utils import pass_environment as pass_environment from .utils import pass_eval_context as pass_eval_context diff --git a/src/jinja2/utils.py b/src/jinja2/utils.py index 976cf711..30206c50 100644 --- a/src/jinja2/utils.py +++ b/src/jinja2/utils.py @@ -3,7 +3,6 @@ import json import os import re import typing as t -import warnings from collections import abc from collections import deque from random import choice @@ -766,24 +765,3 @@ class Namespace: def __repr__(self) -> str: return f"" - - -class Markup(markupsafe.Markup): - def __new__(cls, base="", encoding=None, errors="strict"): # type: ignore - warnings.warn( - "'jinja2.Markup' is deprecated and will be removed in Jinja" - " 3.1. Import 'markupsafe.Markup' instead.", - DeprecationWarning, - stacklevel=2, - ) - return super().__new__(cls, base, encoding, errors) - - -def escape(s: t.Any) -> str: - warnings.warn( - "'jinja2.escape' is deprecated and will be removed in Jinja" - " 3.1. Import 'markupsafe.escape' instead.", - DeprecationWarning, - stacklevel=2, - ) - return markupsafe.escape(s)