diff options
author | David Lord <davidism@gmail.com> | 2020-01-10 10:46:52 -0800 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2020-01-10 12:39:14 -0800 |
commit | 963b5d3c3f426fa36160caef8a1f437e59036bdf (patch) | |
tree | 44a8d969e297055223afe109f2a96b67475f6c8e /src | |
parent | bb6216ea305a06d0157f0c0d0fb8be7bb625c523 (diff) | |
download | jinja2-963b5d3c3f426fa36160caef8a1f437e59036bdf.tar.gz |
ensure deprecation warnings mention version
Diffstat (limited to 'src')
-rw-r--r-- | src/jinja2/environment.py | 9 | ||||
-rw-r--r-- | src/jinja2/filters.py | 11 | ||||
-rw-r--r-- | src/jinja2/sandbox.py | 3 |
3 files changed, 15 insertions, 8 deletions
diff --git a/src/jinja2/environment.py b/src/jinja2/environment.py index d332831..33a7b23 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 79394ad..456a6d4 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 bf4a0f6..d806b63 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 |