mirror of https://github.com/pallets/flask.git
deprecate got_first_request property
This commit is contained in:
parent
704b68948f
commit
2a33c17854
|
@ -23,6 +23,7 @@ Unreleased
|
||||||
|
|
||||||
- Importing ``escape`` and ``Markup`` from ``flask`` is deprecated. Import them
|
- Importing ``escape`` and ``Markup`` from ``flask`` is deprecated. Import them
|
||||||
directly from ``markupsafe`` instead. :pr:`4996`
|
directly from ``markupsafe`` instead. :pr:`4996`
|
||||||
|
- The ``app.got_first_request`` property is deprecated. :pr:`4997`
|
||||||
- Use modern packaging metadata with ``pyproject.toml`` instead of ``setup.cfg``.
|
- Use modern packaging metadata with ``pyproject.toml`` instead of ``setup.cfg``.
|
||||||
:pr:`4947`
|
:pr:`4947`
|
||||||
- Ensure subdomains are applied with nested blueprints. :issue:`4834`
|
- Ensure subdomains are applied with nested blueprints. :issue:`4834`
|
||||||
|
|
|
@ -8,7 +8,6 @@ import weakref
|
||||||
from collections.abc import Iterator as _abc_Iterator
|
from collections.abc import Iterator as _abc_Iterator
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from threading import Lock
|
|
||||||
from types import TracebackType
|
from types import TracebackType
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
@ -496,7 +495,6 @@ class Flask(Scaffold):
|
||||||
# tracks internally if the application already handled at least one
|
# tracks internally if the application already handled at least one
|
||||||
# request.
|
# request.
|
||||||
self._got_first_request = False
|
self._got_first_request = False
|
||||||
self._before_request_lock = Lock()
|
|
||||||
|
|
||||||
# Add a static route using the provided static_url_path, static_host,
|
# Add a static route using the provided static_url_path, static_host,
|
||||||
# and static_folder if there is a configured static_folder.
|
# and static_folder if there is a configured static_folder.
|
||||||
|
@ -592,8 +590,18 @@ class Flask(Scaffold):
|
||||||
"""This attribute is set to ``True`` if the application started
|
"""This attribute is set to ``True`` if the application started
|
||||||
handling the first request.
|
handling the first request.
|
||||||
|
|
||||||
|
.. deprecated:: 2.3
|
||||||
|
Will be removed in Flask 2.4.
|
||||||
|
|
||||||
.. versionadded:: 0.8
|
.. versionadded:: 0.8
|
||||||
"""
|
"""
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
warnings.warn(
|
||||||
|
"'got_first_request' is deprecated and will be removed in Flask 2.4.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
return self._got_first_request
|
return self._got_first_request
|
||||||
|
|
||||||
def make_config(self, instance_relative: bool = False) -> Config:
|
def make_config(self, instance_relative: bool = False) -> Config:
|
||||||
|
|
|
@ -1657,7 +1657,6 @@ def test_no_setup_after_first_request(app, client):
|
||||||
def index():
|
def index():
|
||||||
return "Awesome"
|
return "Awesome"
|
||||||
|
|
||||||
assert not app.got_first_request
|
|
||||||
assert client.get("/").data == b"Awesome"
|
assert client.get("/").data == b"Awesome"
|
||||||
|
|
||||||
with pytest.raises(AssertionError) as exc_info:
|
with pytest.raises(AssertionError) as exc_info:
|
||||||
|
|
Loading…
Reference in New Issue