summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2021-11-09 12:42:59 -0800
committerDavid Lord <davidism@gmail.com>2021-11-10 11:07:04 -0800
commitc6caa4c5b0bb6ef5ac71180b4ec12f34708afb40 (patch)
treed5245e7578624978c1dd8743941076af1a2f0a5f /src
parentac9dbfcf504e71acabdd78ab12b850202a165e5d (diff)
downloadjinja2-c6caa4c5b0bb6ef5ac71180b4ec12f34708afb40.tar.gz
remove deprecated template function decorators
Diffstat (limited to 'src')
-rw-r--r--src/jinja2/__init__.py6
-rw-r--r--src/jinja2/filters.py53
-rw-r--r--src/jinja2/utils.py65
3 files changed, 0 insertions, 124 deletions
diff --git a/src/jinja2/__init__.py b/src/jinja2/__init__.py
index 2c3e66b..ebac176 100644
--- a/src/jinja2/__init__.py
+++ b/src/jinja2/__init__.py
@@ -14,9 +14,6 @@ from .exceptions import TemplateRuntimeError as TemplateRuntimeError
from .exceptions import TemplatesNotFound as TemplatesNotFound
from .exceptions import TemplateSyntaxError as TemplateSyntaxError
from .exceptions import UndefinedError as UndefinedError
-from .filters import contextfilter
-from .filters import environmentfilter
-from .filters import evalcontextfilter
from .loaders import BaseLoader as BaseLoader
from .loaders import ChoiceLoader as ChoiceLoader
from .loaders import DictLoader as DictLoader
@@ -31,10 +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 contextfunction
-from .utils import environmentfunction
from .utils import escape
-from .utils import evalcontextfunction
from .utils import is_undefined as is_undefined
from .utils import Markup
from .utils import pass_context as pass_context
diff --git a/src/jinja2/filters.py b/src/jinja2/filters.py
index ffb98bf..fc5f0c8 100644
--- a/src/jinja2/filters.py
+++ b/src/jinja2/filters.py
@@ -4,7 +4,6 @@ import random
import re
import typing
import typing as t
-import warnings
from collections import abc
from itertools import chain
from itertools import groupby
@@ -44,58 +43,6 @@ K = t.TypeVar("K")
V = t.TypeVar("V")
-def contextfilter(f: F) -> F:
- """Pass the context as the first argument to the decorated function.
-
- .. deprecated:: 3.0
- Will be removed in Jinja 3.1. Use :func:`~jinja2.pass_context`
- instead.
- """
- warnings.warn(
- "'contextfilter' is renamed to 'pass_context', the old name"
- " will be removed in Jinja 3.1.",
- DeprecationWarning,
- stacklevel=2,
- )
- return pass_context(f)
-
-
-def evalcontextfilter(f: F) -> F:
- """Pass the eval context as the first argument to the decorated
- function.
-
- .. deprecated:: 3.0
- Will be removed in Jinja 3.1. Use
- :func:`~jinja2.pass_eval_context` instead.
-
- .. versionadded:: 2.4
- """
- warnings.warn(
- "'evalcontextfilter' is renamed to 'pass_eval_context', the old"
- " name will be removed in Jinja 3.1.",
- DeprecationWarning,
- stacklevel=2,
- )
- return pass_eval_context(f)
-
-
-def environmentfilter(f: F) -> F:
- """Pass the environment as the first argument to the decorated
- function.
-
- .. deprecated:: 3.0
- Will be removed in Jinja 3.1. Use
- :func:`~jinja2.pass_environment` instead.
- """
- warnings.warn(
- "'environmentfilter' is renamed to 'pass_environment', the old"
- " name will be removed in Jinja 3.1.",
- DeprecationWarning,
- stacklevel=2,
- )
- return pass_environment(f)
-
-
def ignore_case(value: V) -> V:
"""For use as a postprocessor for :func:`make_attrgetter`. Converts strings
to lowercase and returns other types as-is."""
diff --git a/src/jinja2/utils.py b/src/jinja2/utils.py
index 567185f..976cf71 100644
--- a/src/jinja2/utils.py
+++ b/src/jinja2/utils.py
@@ -84,74 +84,9 @@ class _PassArg(enum.Enum):
if hasattr(obj, "jinja_pass_arg"):
return obj.jinja_pass_arg # type: ignore
- for prefix in "context", "eval_context", "environment":
- squashed = prefix.replace("_", "")
-
- for name in f"{squashed}function", f"{squashed}filter":
- if getattr(obj, name, False) is True:
- warnings.warn(
- f"{name!r} is deprecated and will stop working"
- f" in Jinja 3.1. Use 'pass_{prefix}' instead.",
- DeprecationWarning,
- stacklevel=2,
- )
- return cls[prefix]
-
return None
-def contextfunction(f: F) -> F:
- """Pass the context as the first argument to the decorated function.
-
- .. deprecated:: 3.0
- Will be removed in Jinja 3.1. Use :func:`~jinja2.pass_context`
- instead.
- """
- warnings.warn(
- "'contextfunction' is renamed to 'pass_context', the old name"
- " will be removed in Jinja 3.1.",
- DeprecationWarning,
- stacklevel=2,
- )
- return pass_context(f)
-
-
-def evalcontextfunction(f: F) -> F:
- """Pass the eval context as the first argument to the decorated
- function.
-
- .. deprecated:: 3.0
- Will be removed in Jinja 3.1. Use
- :func:`~jinja2.pass_eval_context` instead.
-
- .. versionadded:: 2.4
- """
- warnings.warn(
- "'evalcontextfunction' is renamed to 'pass_eval_context', the"
- " old name will be removed in Jinja 3.1.",
- DeprecationWarning,
- stacklevel=2,
- )
- return pass_eval_context(f)
-
-
-def environmentfunction(f: F) -> F:
- """Pass the environment as the first argument to the decorated
- function.
-
- .. deprecated:: 3.0
- Will be removed in Jinja 3.1. Use
- :func:`~jinja2.pass_environment` instead.
- """
- warnings.warn(
- "'environmentfunction' is renamed to 'pass_environment', the"
- " old name will be removed in Jinja 3.1.",
- DeprecationWarning,
- stacklevel=2,
- )
- return pass_environment(f)
-
-
def internalcode(f: F) -> F:
"""Marks the function as internally used"""
internal_code.add(f.__code__)