aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2020-01-10 10:46:52 -0800
committerDavid Lord <davidism@gmail.com>2020-01-10 12:39:14 -0800
commit963b5d3c3f426fa36160caef8a1f437e59036bdf (patch)
tree44a8d969e297055223afe109f2a96b67475f6c8e /src
parentbb6216ea305a06d0157f0c0d0fb8be7bb625c523 (diff)
downloadjinja-963b5d3c3f426fa36160caef8a1f437e59036bdf.tar.gz
ensure deprecation warnings mention version
Diffstat (limited to 'src')
-rw-r--r--src/jinja2/environment.py9
-rw-r--r--src/jinja2/filters.py11
-rw-r--r--src/jinja2/sandbox.py3
3 files changed, 15 insertions, 8 deletions
diff --git a/src/jinja2/environment.py b/src/jinja2/environment.py
index d3328311..33a7b23a 100644
--- a/src/jinja2/environment.py
+++ b/src/jinja2/environment.py
@@ -727,9 +727,14 @@ class Environment(object):
if py_compile:
if not PY2 or PYPY:
- from warnings import warn
+ import warnings
- warn(Warning("py_compile has no effect on pypy or Python 3"))
+ warnings.warn(
+ "'py_compile=True' has no effect on PyPy or Python"
+ " 3 and will be removed in version 3.0",
+ DeprecationWarning,
+ stacklevel=2,
+ )
py_compile = False
else:
import imp
diff --git a/src/jinja2/filters.py b/src/jinja2/filters.py
index 79394ad7..456a6d41 100644
--- a/src/jinja2/filters.py
+++ b/src/jinja2/filters.py
@@ -16,6 +16,10 @@ from collections import namedtuple
from itertools import chain
from itertools import groupby
+from markupsafe import escape
+from markupsafe import Markup
+from markupsafe import soft_unicode
+
from ._compat import abc
from ._compat import imap
from ._compat import iteritems
@@ -23,11 +27,8 @@ from ._compat import string_types
from ._compat import text_type
from .exceptions import FilterArgumentError
from .runtime import Undefined
-from .utils import escape
from .utils import htmlsafe_json_dumps
-from .utils import Markup
from .utils import pformat
-from .utils import soft_unicode
from .utils import unicode_urlencode
from .utils import urlize
@@ -639,7 +640,9 @@ def do_indent(s, width=4, first=False, blank=False, indentfirst=None):
"""
if indentfirst is not None:
warnings.warn(
- DeprecationWarning('The "indentfirst" argument is renamed to "first".'),
+ "The 'indentfirst' argument is renamed to 'first' and will"
+ " be removed in version 3.0.",
+ DeprecationWarning,
stacklevel=2,
)
first = indentfirst
diff --git a/src/jinja2/sandbox.py b/src/jinja2/sandbox.py
index bf4a0f67..d806b634 100644
--- a/src/jinja2/sandbox.py
+++ b/src/jinja2/sandbox.py
@@ -59,14 +59,13 @@ UNSAFE_ASYNC_GENERATOR_ATTRIBUTES = {"ag_code", "ag_frame"}
# make sure we don't warn in python 2.6 about stuff we don't care about
warnings.filterwarnings(
- "ignore", "the sets module", DeprecationWarning, module="jinja2.sandbox"
+ "ignore", "the sets module", DeprecationWarning, module=__name__
)
_mutable_set_types = (set,)
_mutable_mapping_types = (dict,)
_mutable_sequence_types = (list,)
-
# on python 2.x we can register the user collection types
try:
from UserDict import UserDict, DictMixin