未验证 提交 8ab49677 编写于 作者: D David Lord

consistent versions and deprecation messages

上级 16f51ef7
......@@ -98,7 +98,7 @@ def call_factory(script_info, app_factory, args=None, kwargs=None):
if "script_info" in sig.parameters:
warnings.warn(
"The 'script_info' argument is deprecated and will not be"
" passed to the app factory function in 2.1.",
" passed to the app factory function in Flask 2.1.",
DeprecationWarning,
)
kwargs["script_info"] = script_info
......@@ -110,7 +110,8 @@ def call_factory(script_info, app_factory, args=None, kwargs=None):
):
warnings.warn(
"Script info is deprecated and will not be passed as the"
" single argument to the app factory function in 2.1.",
" single argument to the app factory function in Flask"
" 2.1.",
DeprecationWarning,
)
args.append(script_info)
......
......@@ -446,8 +446,9 @@ def _prepare_send_file_kwargs(
):
if attachment_filename is not None:
warnings.warn(
"The 'attachment_filename' parameter has been renamed to 'download_name'."
" The old name will be removed in Flask 2.1.",
"The 'attachment_filename' parameter has been renamed to"
" 'download_name'. The old name will be removed in Flask"
" 2.1.",
DeprecationWarning,
stacklevel=3,
)
......@@ -455,8 +456,8 @@ def _prepare_send_file_kwargs(
if cache_timeout is not None:
warnings.warn(
"The 'cache_timeout' parameter has been renamed to 'max_age'. The old name"
" will be removed in Flask 2.1.",
"The 'cache_timeout' parameter has been renamed to"
" 'max_age'. The old name will be removed in Flask 2.1.",
DeprecationWarning,
stacklevel=3,
)
......@@ -464,8 +465,8 @@ def _prepare_send_file_kwargs(
if add_etags is not None:
warnings.warn(
"The 'add_etags' parameter has been renamed to 'etag'. The old name will be"
" removed in Flask 2.1.",
"The 'add_etags' parameter has been renamed to 'etag'. The"
" old name will be removed in Flask 2.1.",
DeprecationWarning,
stacklevel=3,
)
......@@ -549,7 +550,7 @@ def send_file(
``conditional`` is enabled and ``max_age`` is not set by
default.
.. versionchanged:: 2.0.0
.. versionchanged:: 2.0
``etag`` replaces the ``add_etags`` parameter. It can be a
string to use instead of generating one.
......@@ -629,7 +630,7 @@ def safe_join(directory, *pathnames):
"""
warnings.warn(
"'flask.helpers.safe_join' is deprecated and will be removed in"
" 2.1. Use 'werkzeug.utils.safe_join' instead.",
" Flask 2.1. Use 'werkzeug.utils.safe_join' instead.",
DeprecationWarning,
stacklevel=2,
)
......
......@@ -103,7 +103,7 @@ def dumps(obj, app=None, **kwargs):
:param kwargs: Extra arguments passed to :func:`json.dumps`.
.. versionchanged:: 2.0
``encoding`` is deprecated and will be removed in 2.1.
``encoding`` is deprecated and will be removed in Flask 2.1.
.. versionchanged:: 1.0.3
``app`` can be passed directly, rather than requiring an app
......@@ -115,7 +115,7 @@ def dumps(obj, app=None, **kwargs):
if encoding is not None:
warnings.warn(
"'encoding' is deprecated and will be removed in 2.1.",
"'encoding' is deprecated and will be removed in Flask 2.1.",
DeprecationWarning,
stacklevel=2,
)
......@@ -140,7 +140,7 @@ def dump(obj, fp, app=None, **kwargs):
.. versionchanged:: 2.0
Writing to a binary file, and the ``encoding`` argument, is
deprecated and will be removed in 2.1.
deprecated and will be removed in Flask 2.1.
"""
_dump_arg_defaults(kwargs, app=app)
encoding = kwargs.pop("encoding", None)
......@@ -155,7 +155,7 @@ def dump(obj, fp, app=None, **kwargs):
if show_warning:
warnings.warn(
"Writing to a binary file, and the 'encoding' argument, is"
" deprecated and will be removed in 2.1.",
" deprecated and will be removed in Flask 2.1.",
DeprecationWarning,
stacklevel=2,
)
......@@ -175,8 +175,8 @@ def loads(s, app=None, **kwargs):
:param kwargs: Extra arguments passed to :func:`json.loads`.
.. versionchanged:: 2.0
``encoding`` is deprecated and will be removed in 2.1. The data
must be a string or UTF-8 bytes.
``encoding`` is deprecated and will be removed in Flask 2.1. The
data must be a string or UTF-8 bytes.
.. versionchanged:: 1.0.3
``app`` can be passed directly, rather than requiring an app
......@@ -187,8 +187,8 @@ def loads(s, app=None, **kwargs):
if encoding is not None:
warnings.warn(
"'encoding' is deprecated and will be removed in 2.1. The"
" data must be a string or UTF-8 bytes.",
"'encoding' is deprecated and will be removed in Flask 2.1."
" The data must be a string or UTF-8 bytes.",
DeprecationWarning,
stacklevel=2,
)
......@@ -211,16 +211,17 @@ def load(fp, app=None, **kwargs):
:param kwargs: Extra arguments passed to :func:`json.load`.
.. versionchanged:: 2.0
``encoding`` is deprecated and will be removed in 2.1. The file
must be text mode, or binary mode with UTF-8 bytes.
``encoding`` is deprecated and will be removed in Flask 2.1. The
file must be text mode, or binary mode with UTF-8 bytes.
"""
_load_arg_defaults(kwargs, app=app)
encoding = kwargs.pop("encoding", None)
if encoding is not None:
warnings.warn(
"'encoding' is deprecated and will be removed in 2.1. The"
" file must be text mode, or binary mode with UTF-8 bytes.",
"'encoding' is deprecated and will be removed in Flask 2.1."
" The file must be text mode, or binary mode with UTF-8"
" bytes.",
DeprecationWarning,
stacklevel=2,
)
......
......@@ -56,7 +56,7 @@ class Scaffold:
are relative to. Typically not set, it is discovered based on
the ``import_name``.
.. versionadded:: 2.0.0
.. versionadded:: 2.0
"""
name: str
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册