Skip to content
Myr

deprecate got_first_request property

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent 704b689 · Browse files · 3 files+11 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+11 added−3 removed

  • tests:+0 added−1 removed
  • other:+11 added−2 removed

3 files+11 added−3 removed

modified:src/flask/app.py+10 added-2 removed
6 unmodified lines
7import weakref8from collections.abc import Iterator as _abc_Iterator9from datetime import timedelta10from itertools import chain11from threading import Lock11from types import TracebackType1213import click14from werkzeug.datastructures import Headers
479 unmodified lines
494495 # tracks internally if the application already handled at least one496 # request.497 self._got_first_request = False499 self._before_request_lock = Lock()498499 # Add a static route using the provided static_url_path, static_host,500 # and static_folder if there is a configured static_folder.501 # Note we do this without checking if static_folder exists.
87 unmodified lines
589 def got_first_request(self) -> bool:590 """This attribute is set to ``True`` if the application started591 handling the first request.592593 .. deprecated:: 2.3594 Will be removed in Flask 2.4.595596 .. versionadded:: 0.8597 """598 import warnings599600 warnings.warn(601 "'got_first_request' is deprecated and will be removed in Flask 2.4.",602 DeprecationWarning,603 stacklevel=2,604 )605 return self._got_first_request606607 def make_config(self, instance_relative: bool = False) -> Config:608 """Used to create the config attribute by the Flask constructor.
1619 unmodified lines
modified:tests/test_basic.py-1 removed
1655 unmodified lines
1656 @app.route("/")1657 def index():1658 return "Awesome"16591660 assert not app.got_first_request1660 assert client.get("/").data == b"Awesome"16611662 with pytest.raises(AssertionError) as exc_info:1663 app.add_url_rule("/foo", endpoint="late")
256 unmodified lines
modified:CHANGES.rst+1 added
21 unmodified lines
22 - The ``json.htmlsafe_dumps`` and ``htmlsafe_dump`` functions are removed.2324- Importing ``escape`` and ``Markup`` from ``flask`` is deprecated. Import them25 directly from ``markupsafe`` instead. :pr:`4996`26- The ``app.got_first_request`` property is deprecated. :pr:`4997`27- Use modern packaging metadata with ``pyproject.toml`` instead of ``setup.cfg``.28 :pr:`4947`29- Ensure subdomains are applied with nested blueprints. :issue:`4834`30
1418 unmodified lines