Skip to content
Myr

Merge pull request #4995 from pallets/remove-deprecated

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

remove previously deprecated code

authored by David Lord · committed by GitHub · parents 604de4b, 6650764 · Browse files · 16 files+81 added−946 removed
This commit

State

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

Diff stats

16 files+81 added−946 removed

  • tests:+10 added−71 removed
  • other:+71 added−875 removed

16 files+81 added−946 removed

modified:docs/api.rst-6 removed
268 unmodified lines
269.. autoclass:: flask.json.provider.DefaultJSONProvider270 :members:271 :member-order: bysource272273.. autoclass:: JSONEncoder274 :members:275276.. autoclass:: JSONDecoder277 :members:278273.. automodule:: flask.json.tag274275276Template Rendering
468 unmodified lines
modified:docs/config.rst+5 added-64 removed
63 unmodified lines
64----------------------------6566The following configuration values are used internally by Flask:6768.. py:data:: ENV6970 What environment the app is running in. The :attr:`~flask.Flask.env` attribute maps71 to this config key.7273 Default: ``'production'``7475 .. deprecated:: 2.276 Will be removed in Flask 2.3. Use ``--debug`` instead.7778 .. versionadded:: 1.07968.. py:data:: DEBUG6970 Whether debug mode is enabled. When using ``flask run`` to start the development71 server, an interactive debugger will be shown for unhandled exceptions, and the
186 unmodified lines
258 read for security.259260 Default: ``None``261274.. py:data:: JSON_AS_ASCII275276 Serialize objects to ASCII-encoded JSON. If this is disabled, the277 JSON returned from ``jsonify`` will contain Unicode characters. This278 has security implications when rendering the JSON into JavaScript in279 templates, and should typically remain enabled.280281 Default: ``True``282283 .. deprecated:: 2.2284 Will be removed in Flask 2.3. Set ``app.json.ensure_ascii``285 instead.286287.. py:data:: JSON_SORT_KEYS288289 Sort the keys of JSON objects alphabetically. This is useful for caching290 because it ensures the data is serialized the same way no matter what291 Python's hash seed is. While not recommended, you can disable this for a292 possible performance improvement at the cost of caching.293294 Default: ``True``295296 .. deprecated:: 2.2297 Will be removed in Flask 2.3. Set ``app.json.sort_keys``298 instead.299300.. py:data:: JSONIFY_PRETTYPRINT_REGULAR301302 :func:`~flask.jsonify` responses will be output with newlines,303 spaces, and indentation for easier reading by humans. Always enabled304 in debug mode.305306 Default: ``False``307308 .. deprecated:: 2.2309 Will be removed in Flask 2.3. Set ``app.json.compact`` instead.310311.. py:data:: JSONIFY_MIMETYPE312313 The mimetype of ``jsonify`` responses.314315 Default: ``'application/json'``316317 .. deprecated:: 2.2318 Will be removed in Flask 2.3. Set ``app.json.mimetype`` instead.319262.. py:data:: TEMPLATES_AUTO_RELOAD263264 Reload templates when they are changed. If not set, it will be enabled in265 debug mode.
56 unmodified lines
322323.. versionchanged:: 2.2324 Removed ``PRESERVE_CONTEXT_ON_EXCEPTION``.325384.. versionchanged:: 2.2385 ``JSON_AS_ASCII``, ``JSON_SORT_KEYS``,386 ``JSONIFY_MIMETYPE``, and ``JSONIFY_PRETTYPRINT_REGULAR`` will be387 removed in Flask 2.3. The default ``app.json`` provider has326.. versionchanged:: 2.3327 ``JSON_AS_ASCII``, ``JSON_SORT_KEYS``, ``JSONIFY_MIMETYPE``, and328 ``JSONIFY_PRETTYPRINT_REGULAR`` were removed. The default ``app.json`` provider has329 equivalent attributes instead.330390.. versionchanged:: 2.2391 ``ENV`` will be removed in Flask 2.3. Use ``--debug`` instead.331.. versionchanged:: 2.3332 ``ENV`` was removed.333334335Configuring from Python Files336-----------------------------
385 unmodified lines
modified:src/flask/json/__init__.py+24 added-196 removed
1 unmodified line
23import json as _json4import typing as t56from jinja2.utils import htmlsafe_json_dumps as _jinja_htmlsafe_dumps76from ..globals import current_app7from .provider import _default89if t.TYPE_CHECKING: # pragma: no cover12 from ..app import Flask10 from ..wrappers import Response111216class JSONEncoder(_json.JSONEncoder):17 """The default JSON encoder. Handles extra types compared to the18 built-in :class:`json.JSONEncoder`.1920 - :class:`datetime.datetime` and :class:`datetime.date` are21 serialized to :rfc:`822` strings. This is the same as the HTTP22 date format.23 - :class:`decimal.Decimal` is serialized to a string.24 - :class:`uuid.UUID` is serialized to a string.25 - :class:`dataclasses.dataclass` is passed to26 :func:`dataclasses.asdict`.27 - :class:`~markupsafe.Markup` (or any object with a ``__html__``28 method) will call the ``__html__`` method to get a string.2930 Assign a subclass of this to :attr:`flask.Flask.json_encoder` or31 :attr:`flask.Blueprint.json_encoder` to override the default.3233 .. deprecated:: 2.234 Will be removed in Flask 2.3. Use ``app.json`` instead.35 """3637 def __init__(self, **kwargs) -> None:38 import warnings3940 warnings.warn(41 "'JSONEncoder' is deprecated and will be removed in"42 " Flask 2.3. Use 'Flask.json' to provide an alternate"43 " JSON implementation instead.",44 DeprecationWarning,45 stacklevel=3,46 )47 super().__init__(**kwargs)4849 def default(self, o: t.Any) -> t.Any:50 """Convert ``o`` to a JSON serializable type. See51 :meth:`json.JSONEncoder.default`. Python does not support52 overriding how basic types like ``str`` or ``list`` are53 serialized, they are handled before this method.54 """55 return _default(o)565758class JSONDecoder(_json.JSONDecoder):59 """The default JSON decoder.6061 This does not change any behavior from the built-in62 :class:`json.JSONDecoder`.6364 Assign a subclass of this to :attr:`flask.Flask.json_decoder` or65 :attr:`flask.Blueprint.json_decoder` to override the default.6667 .. deprecated:: 2.268 Will be removed in Flask 2.3. Use ``app.json`` instead.69 """7071 def __init__(self, **kwargs) -> None:72 import warnings7374 warnings.warn(75 "'JSONDecoder' is deprecated and will be removed in"76 " Flask 2.3. Use 'Flask.json' to provide an alternate"77 " JSON implementation instead.",78 DeprecationWarning,79 stacklevel=3,80 )81 super().__init__(**kwargs)828384def dumps(obj: t.Any, *, app: Flask | None = None, **kwargs: t.Any) -> str:13def dumps(obj: t.Any, **kwargs: t.Any) -> str:14 """Serialize data as JSON.1516 If :data:`~flask.current_app` is available, it will use its17 :meth:`app.json.dumps() <flask.json.provider.JSONProvider.dumps>`
1 unmodified line
1920 :param obj: The data to serialize.21 :param kwargs: Arguments passed to the ``dumps`` implementation.2223 .. versionchanged:: 2.324 The ``app`` parameter was removed.2526 .. versionchanged:: 2.227 Calls ``current_app.json.dumps``, allowing an app to override28 the behavior.2998 .. versionchanged:: 2.299 The ``app`` parameter will be removed in Flask 2.3.10030 .. versionchanged:: 2.0.231 :class:`decimal.Decimal` is supported by converting to a string.3233 .. versionchanged:: 2.0
2 unmodified lines
36 .. versionchanged:: 1.0.337 ``app`` can be passed directly, rather than requiring an app38 context for configuration.39 """111 if app is not None:112 import warnings40 if current_app:41 return current_app.json.dumps(obj, **kwargs)42114 warnings.warn(115 "The 'app' parameter is deprecated and will be removed in"116 " Flask 2.3. Call 'app.json.dumps' directly instead.",117 DeprecationWarning,118 stacklevel=2,119 )120 else:121 app = current_app122123 if app:124 return app.json.dumps(obj, **kwargs)12543 kwargs.setdefault("default", _default)44 return _json.dumps(obj, **kwargs)4546130def dump(131 obj: t.Any, fp: t.IO[str], *, app: Flask | None = None, **kwargs: t.Any132) -> None:47def dump(obj: t.Any, fp: t.IO[str], **kwargs: t.Any) -> None:48 """Serialize data as JSON and write to a file.4950 If :data:`~flask.current_app` is available, it will use its51 :meth:`app.json.dump() <flask.json.provider.JSONProvider.dump>`
3 unmodified lines
55 :param fp: A file opened for writing text. Should use the UTF-856 encoding to be valid JSON.57 :param kwargs: Arguments passed to the ``dump`` implementation.5859 .. versionchanged:: 2.360 The ``app`` parameter was removed.6162 .. versionchanged:: 2.263 Calls ``current_app.json.dump``, allowing an app to override64 the behavior.65148 .. versionchanged:: 2.2149 The ``app`` parameter will be removed in Flask 2.3.15066 .. versionchanged:: 2.067 Writing to a binary file, and the ``encoding`` argument, will be68 removed in Flask 2.1.69 """155 if app is not None:156 import warnings157158 warnings.warn(159 "The 'app' parameter is deprecated and will be removed in"160 " Flask 2.3. Call 'app.json.dump' directly instead.",161 DeprecationWarning,162 stacklevel=2,163 )70 if current_app:71 current_app.json.dump(obj, fp, **kwargs)72 else:165 app = current_app166167 if app:168 app.json.dump(obj, fp, **kwargs)169 else:73 kwargs.setdefault("default", _default)74 _json.dump(obj, fp, **kwargs)7576174def loads(s: str | bytes, *, app: Flask | None = None, **kwargs: t.Any) -> t.Any:77def loads(s: str | bytes, **kwargs: t.Any) -> t.Any:78 """Deserialize data as JSON.7980 If :data:`~flask.current_app` is available, it will use its81 :meth:`app.json.loads() <flask.json.provider.JSONProvider.loads>`
1 unmodified line
8384 :param s: Text or UTF-8 bytes.85 :param kwargs: Arguments passed to the ``loads`` implementation.8687 .. versionchanged:: 2.388 The ``app`` parameter was removed.8990 .. versionchanged:: 2.291 Calls ``current_app.json.loads``, allowing an app to override92 the behavior.93188 .. versionchanged:: 2.2189 The ``app`` parameter will be removed in Flask 2.3.19094 .. versionchanged:: 2.095 ``encoding`` will be removed in Flask 2.1. The data must be a96 string or UTF-8 bytes.9798 .. versionchanged:: 1.0.399 ``app`` can be passed directly, rather than requiring an app100 context for configuration.101 """199 if app is not None:200 import warnings102 if current_app:103 return current_app.json.loads(s, **kwargs)104202 warnings.warn(203 "The 'app' parameter is deprecated and will be removed in"204 " Flask 2.3. Call 'app.json.loads' directly instead.",205 DeprecationWarning,206 stacklevel=2,207 )208 else:209 app = current_app210211 if app:212 return app.json.loads(s, **kwargs)213105 return _json.loads(s, **kwargs)106107217def load(fp: t.IO[t.AnyStr], *, app: Flask | None = None, **kwargs: t.Any) -> t.Any:108def load(fp: t.IO[t.AnyStr], **kwargs: t.Any) -> t.Any:109 """Deserialize data as JSON read from a file.110111 If :data:`~flask.current_app` is available, it will use its112 :meth:`app.json.load() <flask.json.provider.JSONProvider.load>`
1 unmodified line
114115 :param fp: A file opened for reading text or UTF-8 bytes.116 :param kwargs: Arguments passed to the ``load`` implementation.117118 .. versionchanged:: 2.3119 The ``app`` parameter was removed.120121 .. versionchanged:: 2.2122 Calls ``current_app.json.load``, allowing an app to override123 the behavior.124
3 unmodified lines
128 .. versionchanged:: 2.0129 ``encoding`` will be removed in Flask 2.1. The file must be text130 mode, or binary mode with UTF-8 bytes.131 """238 if app is not None:239 import warnings132 if current_app:133 return current_app.json.load(fp, **kwargs)134241 warnings.warn(242 "The 'app' parameter is deprecated and will be removed in"243 " Flask 2.3. Call 'app.json.load' directly instead.",244 DeprecationWarning,245 stacklevel=2,246 )247 else:248 app = current_app249250 if app:251 return app.json.load(fp, **kwargs)252135 return _json.load(fp, **kwargs)136137256def htmlsafe_dumps(obj: t.Any, **kwargs: t.Any) -> str:257 """Serialize an object to a string of JSON with :func:`dumps`, then258 replace HTML-unsafe characters with Unicode escapes and mark the259 result safe with :class:`~markupsafe.Markup`.260261 This is available in templates as the ``|tojson`` filter.262263 The returned string is safe to render in HTML documents and264 ``<script>`` tags. The exception is in HTML attributes that are265 double quoted; either use single quotes or the ``|forceescape``266 filter.267268 .. deprecated:: 2.2269 Will be removed in Flask 2.3. This is built-in to Jinja now.270271 .. versionchanged:: 2.0272 Uses :func:`jinja2.utils.htmlsafe_json_dumps`. The returned273 value is marked safe by wrapping in :class:`~markupsafe.Markup`.274275 .. versionchanged:: 0.10276 Single quotes are escaped, making this safe to use in HTML,277 ``<script>`` tags, and single-quoted attributes without further278 escaping.279 """280 import warnings281282 warnings.warn(283 "'htmlsafe_dumps' is deprecated and will be removed in Flask"284 " 2.3. Use 'jinja2.utils.htmlsafe_json_dumps' instead.",285 DeprecationWarning,286 stacklevel=2,287 )288 return _jinja_htmlsafe_dumps(obj, dumps=dumps, **kwargs)289290291def htmlsafe_dump(obj: t.Any, fp: t.IO[str], **kwargs: t.Any) -> None:292 """Serialize an object to JSON written to a file object, replacing293 HTML-unsafe characters with Unicode escapes. See294 :func:`htmlsafe_dumps` and :func:`dumps`.295296 .. deprecated:: 2.2297 Will be removed in Flask 2.3.298 """299 import warnings300301 warnings.warn(302 "'htmlsafe_dump' is deprecated and will be removed in Flask"303 " 2.3. Use 'jinja2.utils.htmlsafe_json_dumps' instead.",304 DeprecationWarning,305 stacklevel=2,306 )307 fp.write(htmlsafe_dumps(obj, **kwargs))308309138def jsonify(*args: t.Any, **kwargs: t.Any) -> Response:139 """Serialize the given arguments as JSON, and return a140 :class:`~flask.Response` object with the ``application/json``141 mimetype. A dict or list returned from a view will be converted to a
29 unmodified lines
modified:src/flask/json/provider.py+5 added-99 removed
8 unmodified lines
9from datetime import date1011from werkzeug.http import http_date1213from ..globals import request1413if t.TYPE_CHECKING: # pragma: no cover14 from ..app import Flask15 from ..wrappers import Response16
156 unmodified lines
173174 :param obj: The data to serialize.175 :param kwargs: Passed to :func:`json.dumps`.176 """179 cls = self._app._json_encoder180 bp = self._app.blueprints.get(request.blueprint) if request else None181182 if bp is not None and bp._json_encoder is not None:183 cls = bp._json_encoder184185 if cls is not None:186 import warnings187188 warnings.warn(189 "Setting 'json_encoder' on the app or a blueprint is"190 " deprecated and will be removed in Flask 2.3."191 " Customize 'app.json' instead.",192 DeprecationWarning,193 )194 kwargs.setdefault("cls", cls)195196 if "default" not in cls.__dict__:197 kwargs.setdefault("default", self.default)198 else:199 kwargs.setdefault("default", self.default)200201 ensure_ascii = self._app.config["JSON_AS_ASCII"]202 sort_keys = self._app.config["JSON_SORT_KEYS"]203204 if ensure_ascii is not None:205 import warnings206207 warnings.warn(208 "The 'JSON_AS_ASCII' config key is deprecated and will"209 " be removed in Flask 2.3. Set 'app.json.ensure_ascii'"210 " instead.",211 DeprecationWarning,212 )213 else:214 ensure_ascii = self.ensure_ascii215216 if sort_keys is not None:217 import warnings218219 warnings.warn(220 "The 'JSON_SORT_KEYS' config key is deprecated and will"221 " be removed in Flask 2.3. Set 'app.json.sort_keys'"222 " instead.",223 DeprecationWarning,224 )225 else:226 sort_keys = self.sort_keys227228 kwargs.setdefault("ensure_ascii", ensure_ascii)229 kwargs.setdefault("sort_keys", sort_keys)177 kwargs.setdefault("default", self.default)178 kwargs.setdefault("ensure_ascii", self.ensure_ascii)179 kwargs.setdefault("sort_keys", self.sort_keys)180 return json.dumps(obj, **kwargs)181182 def loads(self, s: str | bytes, **kwargs: t.Any) -> t.Any:183 """Deserialize data as JSON from a string or bytes.184185 :param s: Text or UTF-8 bytes.186 :param kwargs: Passed to :func:`json.loads`.187 """238 cls = self._app._json_decoder239 bp = self._app.blueprints.get(request.blueprint) if request else None240241 if bp is not None and bp._json_decoder is not None:242 cls = bp._json_decoder243244 if cls is not None:245 import warnings246247 warnings.warn(248 "Setting 'json_decoder' on the app or a blueprint is"249 " deprecated and will be removed in Flask 2.3."250 " Customize 'app.json' instead.",251 DeprecationWarning,252 )253 kwargs.setdefault("cls", cls)254188 return json.loads(s, **kwargs)189190 def response(self, *args: t.Any, **kwargs: t.Any) -> Response:191 """Serialize the given arguments as JSON, and return a
12 unmodified lines
204 :param kwargs: Treat as a dict to serialize.205 """206 obj = self._prepare_response_obj(args, kwargs)207 dump_args: t.Dict[str, t.Any] = {}275 pretty = self._app.config["JSONIFY_PRETTYPRINT_REGULAR"]276 mimetype = self._app.config["JSONIFY_MIMETYPE"]208278 if pretty is not None:279 import warnings280281 warnings.warn(282 "The 'JSONIFY_PRETTYPRINT_REGULAR' config key is"283 " deprecated and will be removed in Flask 2.3. Set"284 " 'app.json.compact' instead.",285 DeprecationWarning,286 )287 compact: bool | None = not pretty288 else:289 compact = self.compact290291 if (compact is None and self._app.debug) or compact is False:209 if (self.compact is None and self._app.debug) or self.compact is False:210 dump_args.setdefault("indent", 2)211 else:212 dump_args.setdefault("separators", (",", ":"))213296 if mimetype is not None:297 import warnings298299 warnings.warn(300 "The 'JSONIFY_MIMETYPE' config key is deprecated and"301 " will be removed in Flask 2.3. Set 'app.json.mimetype'"302 " instead.",303 DeprecationWarning,304 )305 else:306 mimetype = self.mimetype307214 return self._app.response_class(309 f"{self.dumps(obj, **dump_args)}\n", mimetype=mimetype215 f"{self.dumps(obj, **dump_args)}\n", mimetype=self.mimetype216 )
modified:src/flask/__init__.py+2 added-2 removed
49 unmodified lines
50 import warnings51 from .globals import __app_ctx_stack5253 warnings.warn(54 "'_app_ctx_stack' is deprecated and will be removed in Flask 2.3.",54 "'_app_ctx_stack' is deprecated and will be removed in Flask 2.4.",55 DeprecationWarning,56 stacklevel=2,57 )58 return __app_ctx_stack
2 unmodified lines
61 import warnings62 from .globals import __request_ctx_stack6364 warnings.warn(65 "'_request_ctx_stack' is deprecated and will be removed in Flask 2.3.",65 "'_request_ctx_stack' is deprecated and will be removed in Flask 2.4.",66 DeprecationWarning,67 stacklevel=2,68 )69 return __request_ctx_stack
2 unmodified lines
modified:src/flask/app.py+4 added-336 removed
1import functools2import inspect3import json3import logging4import os5import sys6import typing as t
66 unmodified lines
73 from .blueprints import Blueprint74 from .testing import FlaskClient75 from .testing import FlaskCliRunner7678T_before_first_request = t.TypeVar(79 "T_before_first_request", bound=ft.BeforeFirstRequestCallable80)77T_shell_context_processor = t.TypeVar(78 "T_shell_context_processor", bound=ft.ShellContextProcessorCallable79)80T_teardown = t.TypeVar("T_teardown", bound=ft.TeardownCallable)
188 unmodified lines
269 #: This attribute can also be configured from the config with the270 #: :data:`SECRET_KEY` configuration key. Defaults to ``None``.271 secret_key = ConfigAttribute("SECRET_KEY")272277 @property278 def session_cookie_name(self) -> str:279 """The name of the cookie set by the session interface.280281 .. deprecated:: 2.2282 Will be removed in Flask 2.3. Use ``app.config["SESSION_COOKIE_NAME"]``283 instead.284 """285 import warnings286287 warnings.warn(288 "'session_cookie_name' is deprecated and will be removed in Flask 2.3. Use"289 " 'SESSION_COOKIE_NAME' in 'app.config' instead.",290 DeprecationWarning,291 stacklevel=2,292 )293 return self.config["SESSION_COOKIE_NAME"]294295 @session_cookie_name.setter296 def session_cookie_name(self, value: str) -> None:297 import warnings298299 warnings.warn(300 "'session_cookie_name' is deprecated and will be removed in Flask 2.3. Use"301 " 'SESSION_COOKIE_NAME' in 'app.config' instead.",302 DeprecationWarning,303 stacklevel=2,304 )305 self.config["SESSION_COOKIE_NAME"] = value306273 #: A :class:`~datetime.timedelta` which is used to set the expiration274 #: date of a permanent session. The default is 31 days which makes a275 #: permanent session survive for roughly one month.276 #:
3 unmodified lines
280 permanent_session_lifetime = ConfigAttribute(281 "PERMANENT_SESSION_LIFETIME", get_converter=_make_timedelta282 )283318 @property319 def send_file_max_age_default(self) -> t.Optional[timedelta]:320 """The default value for ``max_age`` for :func:`~flask.send_file`. The default321 is ``None``, which tells the browser to use conditional requests instead of a322 timed cache.323324 .. deprecated:: 2.2325 Will be removed in Flask 2.3. Use326 ``app.config["SEND_FILE_MAX_AGE_DEFAULT"]`` instead.327328 .. versionchanged:: 2.0329 Defaults to ``None`` instead of 12 hours.330 """331 import warnings332333 warnings.warn(334 "'send_file_max_age_default' is deprecated and will be removed in Flask"335 " 2.3. Use 'SEND_FILE_MAX_AGE_DEFAULT' in 'app.config' instead.",336 DeprecationWarning,337 stacklevel=2,338 )339 return _make_timedelta(self.config["SEND_FILE_MAX_AGE_DEFAULT"])340341 @send_file_max_age_default.setter342 def send_file_max_age_default(self, value: t.Union[int, timedelta, None]) -> None:343 import warnings344345 warnings.warn(346 "'send_file_max_age_default' is deprecated and will be removed in Flask"347 " 2.3. Use 'SEND_FILE_MAX_AGE_DEFAULT' in 'app.config' instead.",348 DeprecationWarning,349 stacklevel=2,350 )351 self.config["SEND_FILE_MAX_AGE_DEFAULT"] = _make_timedelta(value)352353 @property354 def use_x_sendfile(self) -> bool:355 """Enable this to use the ``X-Sendfile`` feature, assuming the server supports356 it, from :func:`~flask.send_file`.357358 .. deprecated:: 2.2359 Will be removed in Flask 2.3. Use ``app.config["USE_X_SENDFILE"]`` instead.360 """361 import warnings362363 warnings.warn(364 "'use_x_sendfile' is deprecated and will be removed in Flask 2.3. Use"365 " 'USE_X_SENDFILE' in 'app.config' instead.",366 DeprecationWarning,367 stacklevel=2,368 )369 return self.config["USE_X_SENDFILE"]370371 @use_x_sendfile.setter372 def use_x_sendfile(self, value: bool) -> None:373 import warnings374375 warnings.warn(376 "'use_x_sendfile' is deprecated and will be removed in Flask 2.3. Use"377 " 'USE_X_SENDFILE' in 'app.config' instead.",378 DeprecationWarning,379 stacklevel=2,380 )381 self.config["USE_X_SENDFILE"] = value382383 _json_encoder: t.Union[t.Type[json.JSONEncoder], None] = None384 _json_decoder: t.Union[t.Type[json.JSONDecoder], None] = None385386 @property # type: ignore[override]387 def json_encoder(self) -> t.Type[json.JSONEncoder]:388 """The JSON encoder class to use. Defaults to389 :class:`~flask.json.JSONEncoder`.390391 .. deprecated:: 2.2392 Will be removed in Flask 2.3. Customize393 :attr:`json_provider_class` instead.394395 .. versionadded:: 0.10396 """397 import warnings398399 warnings.warn(400 "'app.json_encoder' is deprecated and will be removed in Flask 2.3."401 " Customize 'app.json_provider_class' or 'app.json' instead.",402 DeprecationWarning,403 stacklevel=2,404 )405406 if self._json_encoder is None:407 from . import json408409 return json.JSONEncoder410411 return self._json_encoder412413 @json_encoder.setter414 def json_encoder(self, value: t.Type[json.JSONEncoder]) -> None:415 import warnings416417 warnings.warn(418 "'app.json_encoder' is deprecated and will be removed in Flask 2.3."419 " Customize 'app.json_provider_class' or 'app.json' instead.",420 DeprecationWarning,421 stacklevel=2,422 )423 self._json_encoder = value424425 @property # type: ignore[override]426 def json_decoder(self) -> t.Type[json.JSONDecoder]:427 """The JSON decoder class to use. Defaults to428 :class:`~flask.json.JSONDecoder`.429430 .. deprecated:: 2.2431 Will be removed in Flask 2.3. Customize432 :attr:`json_provider_class` instead.433434 .. versionadded:: 0.10435 """436 import warnings437438 warnings.warn(439 "'app.json_decoder' is deprecated and will be removed in Flask 2.3."440 " Customize 'app.json_provider_class' or 'app.json' instead.",441 DeprecationWarning,442 stacklevel=2,443 )444445 if self._json_decoder is None:446 from . import json447448 return json.JSONDecoder449450 return self._json_decoder451452 @json_decoder.setter453 def json_decoder(self, value: t.Type[json.JSONDecoder]) -> None:454 import warnings455456 warnings.warn(457 "'app.json_decoder' is deprecated and will be removed in Flask 2.3."458 " Customize 'app.json_provider_class' or 'app.json' instead.",459 DeprecationWarning,460 stacklevel=2,461 )462 self._json_decoder = value463284 json_provider_class: t.Type[JSONProvider] = DefaultJSONProvider285 """A subclass of :class:`~flask.json.provider.JSONProvider`. An286 instance is created and assigned to :attr:`app.json` when creating287 the app.
18 unmodified lines
306307 #: Default configuration parameters.308 default_config = ImmutableDict(309 {490 "ENV": None,310 "DEBUG": None,311 "TESTING": False,312 "PROPAGATE_EXCEPTIONS": None,313 "SECRET_KEY": None,
13 unmodified lines
327 "TRAP_BAD_REQUEST_ERRORS": None,328 "TRAP_HTTP_EXCEPTIONS": False,329 "EXPLAIN_TEMPLATE_LOADING": False,330 "PREFERRED_URL_SCHEME": "http",512 "JSON_AS_ASCII": None,513 "JSON_SORT_KEYS": None,514 "JSONIFY_PRETTYPRINT_REGULAR": None,515 "JSONIFY_MIMETYPE": None,331 "TEMPLATES_AUTO_RELOAD": None,332 "MAX_COOKIE_SIZE": 4093,333 }334 )
104 unmodified lines
439 self.url_build_error_handlers: t.List[440 t.Callable[[Exception, str, t.Dict[str, t.Any]], str]441 ] = []442628 #: A list of functions that will be called at the beginning of the629 #: first request to this instance. To register a function, use the630 #: :meth:`before_first_request` decorator.631 #:632 #: .. deprecated:: 2.2633 #: Will be removed in Flask 2.3. Run setup code when634 #: creating the application instead.635 #:636 #: .. versionadded:: 0.8637 self.before_first_request_funcs: t.List[ft.BeforeFirstRequestCallable] = []638443 #: A list of functions that are called when the application context444 #: is destroyed. Since the application context is also torn down445 #: if the request ends this is the place to store code that disconnects446 #: from databases.
102 unmodified lines
549 return "__main__"550 return os.path.splitext(os.path.basename(fn))[0]551 return self.import_name552749 @property750 def propagate_exceptions(self) -> bool:751 """Returns the value of the ``PROPAGATE_EXCEPTIONS`` configuration752 value in case it's set, otherwise a sensible default is returned.753754 .. deprecated:: 2.2755 Will be removed in Flask 2.3.756757 .. versionadded:: 0.7758 """759 import warnings760761 warnings.warn(762 "'propagate_exceptions' is deprecated and will be removed in Flask 2.3.",763 DeprecationWarning,764 stacklevel=2,765 )766 rv = self.config["PROPAGATE_EXCEPTIONS"]767 if rv is not None:768 return rv769 return self.testing or self.debug770553 @locked_cached_property554 def logger(self) -> logging.Logger:555 """A standard Python :class:`~logging.Logger` for the app, with556 the same name as :attr:`name`.
51 unmodified lines
608 root_path = self.root_path609 if instance_relative:610 root_path = self.instance_path611 defaults = dict(self.default_config)830 defaults["ENV"] = os.environ.get("FLASK_ENV") or "production"612 defaults["DEBUG"] = get_debug_flag()613 return self.config_class(root_path, defaults)614615 def make_aborter(self) -> Aborter:
32 unmodified lines
648 :param mode: resource file opening mode, default is 'rb'.649 """650 return open(os.path.join(self.instance_path, resource), mode)651871 @property872 def templates_auto_reload(self) -> bool:873 """Reload templates when they are changed. Used by874 :meth:`create_jinja_environment`. It is enabled by default in debug mode.875876 .. deprecated:: 2.2877 Will be removed in Flask 2.3. Use ``app.config["TEMPLATES_AUTO_RELOAD"]``878 instead.879880 .. versionadded:: 1.0881 This property was added but the underlying config and behavior882 already existed.883 """884 import warnings885886 warnings.warn(887 "'templates_auto_reload' is deprecated and will be removed in Flask 2.3."888 " Use 'TEMPLATES_AUTO_RELOAD' in 'app.config' instead.",889 DeprecationWarning,890 stacklevel=2,891 )892 rv = self.config["TEMPLATES_AUTO_RELOAD"]893 return rv if rv is not None else self.debug894895 @templates_auto_reload.setter896 def templates_auto_reload(self, value: bool) -> None:897 import warnings898899 warnings.warn(900 "'templates_auto_reload' is deprecated and will be removed in Flask 2.3."901 " Use 'TEMPLATES_AUTO_RELOAD' in 'app.config' instead.",902 DeprecationWarning,903 stacklevel=2,904 )905 self.config["TEMPLATES_AUTO_RELOAD"] = value906652 def create_jinja_environment(self) -> Environment:653 """Create the Jinja environment based on :attr:`jinja_options`654 and the various Jinja-related methods of the app. Changing655 :attr:`jinja_options` after this will have no effect. Also adds
99 unmodified lines
755 rv.update(processor())756 return rv757758 @property1014 def env(self) -> str:1015 """What environment the app is running in. This maps to the :data:`ENV` config1016 key.10171018 **Do not enable development when deploying in production.**10191020 Default: ``'production'``10211022 .. deprecated:: 2.21023 Will be removed in Flask 2.3.1024 """1025 import warnings10261027 warnings.warn(1028 "'app.env' is deprecated and will be removed in Flask 2.3."1029 " Use 'app.debug' instead.",1030 DeprecationWarning,1031 stacklevel=2,1032 )1033 return self.config["ENV"]10341035 @env.setter1036 def env(self, value: str) -> None:1037 import warnings10381039 warnings.warn(1040 "'app.env' is deprecated and will be removed in Flask 2.3."1041 " Use 'app.debug' instead.",1042 DeprecationWarning,1043 stacklevel=2,1044 )1045 self.config["ENV"] = value10461047 @property759 def debug(self) -> bool:760 """Whether debug mode is enabled. When using ``flask run`` to start the761 development server, an interactive debugger will be shown for unhandled762 exceptions, and the server will be reloaded when code changes. This maps to the
91 unmodified lines
854855 if get_load_dotenv(load_dotenv):856 cli.load_dotenv()8571147 # if set, let env vars override previous values1148 if "FLASK_ENV" in os.environ:1149 print(1150 "'FLASK_ENV' is deprecated and will not be used in"1151 " Flask 2.3. Use 'FLASK_DEBUG' instead.",1152 file=sys.stderr,1153 )1154 self.config["ENV"] = os.environ.get("FLASK_ENV") or "production"858 # if set, env var overrides existing value859 if "FLASK_DEBUG" in os.environ:860 self.debug = get_debug_flag()1156 elif "FLASK_DEBUG" in os.environ:1157 self.debug = get_debug_flag()861862 # debug passed to method overrides all other sources863 if debug is not None:864 self.debug = bool(debug)
317 unmodified lines
1182 """1183 self.jinja_env.globals[name or f.__name__] = f11841185 @setupmethod1483 def before_first_request(self, f: T_before_first_request) -> T_before_first_request:1484 """Registers a function to be run before the first request to this1485 instance of the application.14861487 The function will be called without any arguments and its return1488 value is ignored.14891490 .. deprecated:: 2.21491 Will be removed in Flask 2.3. Run setup code when creating1492 the application instead.14931494 .. versionadded:: 0.81495 """1496 import warnings14971498 warnings.warn(1499 "'before_first_request' is deprecated and will be removed"1500 " in Flask 2.3. Run setup code while creating the"1501 " application instead.",1502 DeprecationWarning,1503 stacklevel=2,1504 )1505 self.before_first_request_funcs.append(f)1506 return f15071508 @setupmethod1186 def teardown_appcontext(self, f: T_teardown) -> T_teardown:1187 """Registers a function to be called when the application1188 context is popped. The application context is typically popped1189 after the request context for each request, at the end of CLI
168 unmodified lines
1358 This always causes a 500 ``InternalServerError``.13591360 Always sends the :data:`got_request_exception` signal.13611685 If :attr:`propagate_exceptions` is ``True``, such as in debug1362 If :data:`PROPAGATE_EXCEPTIONS` is ``True``, such as in debug1363 mode, the error will be re-raised so that the debugger can1364 display it. Otherwise, the original exception is logged, and1365 an :exc:`~werkzeug.exceptions.InternalServerError` is returned.1366
114 unmodified lines
1481 error handling.14821483 .. versionadded:: 0.71484 """1808 # Run before_first_request functions if this is the thread's first request.1809 # Inlined to avoid a method call on subsequent requests.1810 # This is deprecated, will be removed in Flask 2.3.1811 if not self._got_first_request:1812 with self._before_request_lock:1813 if not self._got_first_request:1814 for func in self.before_first_request_funcs:1815 self.ensure_sync(func)()1485 self._got_first_request = True14861817 self._got_first_request = True18181487 try:1488 request_started.send(self)1489 rv = self.preprocess_request()1490 if rv is None:
729 unmodified lines
modified:src/flask/blueprints.py+4 added-102 removed
1import json1import os2import typing as t3from collections import defaultdict4from functools import update_wrapper
8 unmodified lines
13 from .app import Flask1415DeferredSetupFunction = t.Callable[["BlueprintSetupState"], t.Callable]16T_after_request = t.TypeVar("T_after_request", bound=ft.AfterRequestCallable)18T_before_first_request = t.TypeVar(19 "T_before_first_request", bound=ft.BeforeFirstRequestCallable20)17T_before_request = t.TypeVar("T_before_request", bound=ft.BeforeRequestCallable)18T_error_handler = t.TypeVar("T_error_handler", bound=ft.ErrorHandlerCallable)19T_teardown = t.TypeVar("T_teardown", bound=ft.TeardownCallable)20T_template_context_processor = t.TypeVar(
147 unmodified lines
168 """169170 _got_registered_once = False171176 _json_encoder: t.Union[t.Type[json.JSONEncoder], None] = None177 _json_decoder: t.Union[t.Type[json.JSONDecoder], None] = None178179 @property180 def json_encoder(181 self,182 ) -> t.Union[t.Type[json.JSONEncoder], None]:183 """Blueprint-local JSON encoder class to use. Set to ``None`` to use the app's.184185 .. deprecated:: 2.2186 Will be removed in Flask 2.3. Customize187 :attr:`json_provider_class` instead.188189 .. versionadded:: 0.10190 """191 import warnings192193 warnings.warn(194 "'bp.json_encoder' is deprecated and will be removed in Flask 2.3."195 " Customize 'app.json_provider_class' or 'app.json' instead.",196 DeprecationWarning,197 stacklevel=2,198 )199 return self._json_encoder200201 @json_encoder.setter202 def json_encoder(self, value: t.Union[t.Type[json.JSONEncoder], None]) -> None:203 import warnings204205 warnings.warn(206 "'bp.json_encoder' is deprecated and will be removed in Flask 2.3."207 " Customize 'app.json_provider_class' or 'app.json' instead.",208 DeprecationWarning,209 stacklevel=2,210 )211 self._json_encoder = value212213 @property214 def json_decoder(215 self,216 ) -> t.Union[t.Type[json.JSONDecoder], None]:217 """Blueprint-local JSON decoder class to use. Set to ``None`` to use the app's.218219 .. deprecated:: 2.2220 Will be removed in Flask 2.3. Customize221 :attr:`json_provider_class` instead.222223 .. versionadded:: 0.10224 """225 import warnings226227 warnings.warn(228 "'bp.json_decoder' is deprecated and will be removed in Flask 2.3."229 " Customize 'app.json_provider_class' or 'app.json' instead.",230 DeprecationWarning,231 stacklevel=2,232 )233 return self._json_decoder234235 @json_decoder.setter236 def json_decoder(self, value: t.Union[t.Type[json.JSONDecoder], None]) -> None:237 import warnings238239 warnings.warn(240 "'bp.json_decoder' is deprecated and will be removed in Flask 2.3."241 " Customize 'app.json_provider_class' or 'app.json' instead.",242 DeprecationWarning,243 stacklevel=2,244 )245 self._json_decoder = value246172 def __init__(173 self,174 name: str,175 import_name: str,
109 unmodified lines
285286 .. versionchanged:: 2.3287 Nested blueprints now correctly apply subdomains.288289 .. versionchanged:: 2.1290 Registering the same blueprint with the same name multiple291 times is an error.292293 .. versionchanged:: 2.0.1294 Nested blueprints are registered with their dotted name.295 This allows different blueprints with the same name to be296 nested at different locations.
2 unmodified lines
299 The ``name`` option can be used to change the (pre-dotted)300 name the blueprint is registered with. This allows the same301 blueprint to be registered multiple times with unique names302 for ``url_for``.374375 .. versionchanged:: 2.0.1376 Registering the same blueprint with the same name multiple377 times is deprecated and will become an error in Flask 2.1.303 """304 name_prefix = options.get("name_prefix", "")305 self_name = options.get("name", self.name)306 name = f"{name_prefix}.{self_name}".lstrip(".")
252 unmodified lines
559 )560 return f561562 @setupmethod638 def before_app_first_request(639 self, f: T_before_first_request640 ) -> T_before_first_request:641 """Register a function to run before the first request to the application is642 handled by the worker. Equivalent to :meth:`.Flask.before_first_request`.643644 .. deprecated:: 2.2645 Will be removed in Flask 2.3. Run setup code when creating646 the application instead.647 """648 import warnings649650 warnings.warn(651 "'before_app_first_request' is deprecated and will be"652 " removed in Flask 2.3. Use 'record_once' instead to run"653 " setup code when registering the blueprint.",654 DeprecationWarning,655 stacklevel=2,656 )657 self.record_once(lambda s: s.app.before_first_request_funcs.append(f))658 return f659660 @setupmethod563 def after_app_request(self, f: T_after_request) -> T_after_request:564 """Like :meth:`after_request`, but after every request, not only those handled565 by the blueprint. Equivalent to :meth:`.Flask.after_request`.566 """
62 unmodified lines
modified:src/flask/globals.py+8 added-21 removed
15 unmodified lines
16 def __init__(self, name: str, cv: ContextVar[t.Any]) -> None:17 self.name = name18 self.cv = cv1920 def _warn(self):20 @property21 def top(self) -> t.Optional[t.Any]:22 import warnings2324 warnings.warn(24 f"'_{self.name}_ctx_stack' is deprecated and will be"25 " removed in Flask 2.3. Use 'g' to store data, or"26 f" '{self.name}_ctx' to access the current context.",25 f"'_{self.name}_ctx_stack' is deprecated and will be removed in Flask 2.4."26 f" Use 'g' to store data, or '{self.name}_ctx' to access the current"27 " context.",28 DeprecationWarning,28 stacklevel=3,29 stacklevel=2,30 )3031 def push(self, obj: t.Any) -> None:32 self._warn()33 self.cv.set(obj)3435 def pop(self) -> t.Any:36 self._warn()37 ctx = self.cv.get(None)38 self.cv.set(None)39 return ctx4041 @property42 def top(self) -> t.Optional[t.Any]:43 self._warn()31 return self.cv.get(None)323334_no_app_msg = """\
39 unmodified lines
74 if name == "_app_ctx_stack":75 import warnings7677 warnings.warn(91 "'_app_ctx_stack' is deprecated and will be removed in Flask 2.3.",78 "'_app_ctx_stack' is deprecated and will be removed in Flask 2.4.",79 DeprecationWarning,80 stacklevel=2,81 )82 return __app_ctx_stack
1 unmodified line
84 if name == "_request_ctx_stack":85 import warnings8687 warnings.warn(101 "'_request_ctx_stack' is deprecated and will be removed in Flask 2.3.",88 "'_request_ctx_stack' is deprecated and will be removed in Flask 2.4.",89 DeprecationWarning,90 stacklevel=2,91 )92 return __request_ctx_stack
2 unmodified lines
modified:src/flask/helpers.py+1 added-34 removed
23 unmodified lines
24 from .wrappers import Response25 import typing_extensions as te262728def get_env() -> str:29 """Get the environment the app is running in, indicated by the30 :envvar:`FLASK_ENV` environment variable. The default is31 ``'production'``.3233 .. deprecated:: 2.234 Will be removed in Flask 2.3.35 """36 import warnings3738 warnings.warn(39 "'FLASK_ENV' and 'get_env' are deprecated and will be removed"40 " in Flask 2.3. Use 'FLASK_DEBUG' instead.",41 DeprecationWarning,42 stacklevel=2,43 )44 return os.environ.get("FLASK_ENV") or "production"454628def get_debug_flag() -> bool:29 """Get whether debug mode should be enabled for the app, indicated by the30 :envvar:`FLASK_DEBUG` environment variable. The default is ``False``.31 """32 val = os.environ.get("FLASK_DEBUG")33 return bool(val and val.lower() not in {"0", "false", "no"})3453 if not val:54 env = os.environ.get("FLASK_ENV")3556 if env is not None:57 print(58 "'FLASK_ENV' is deprecated and will not be used in"59 " Flask 2.3. Use 'FLASK_DEBUG' instead.",60 file=sys.stderr,61 )62 return env == "development"6364 return False6566 return val.lower() not in {"0", "false", "no"}676836def get_load_dotenv(default: bool = True) -> bool:37 """Get whether the user has disabled loading default dotenv files by38 setting :envvar:`FLASK_SKIP_DOTENV`. The default is ``True``, load39 the files.
633 unmodified lines
modified:src/flask/scaffold.py-15 removed
1import importlib.util2import json2import os3import pathlib4import pkgutil5import sys
66 unmodified lines
72 name: str73 _static_folder: t.Optional[str] = None74 _static_url_path: t.Optional[str] = None7577 #: JSON encoder class used by :func:`flask.json.dumps`. If a78 #: blueprint sets this, it will be used instead of the app's value.79 #:80 #: .. deprecated:: 2.281 #: Will be removed in Flask 2.3.82 json_encoder: t.Union[t.Type[json.JSONEncoder], None] = None8384 #: JSON decoder class used by :func:`flask.json.loads`. If a85 #: blueprint sets this, it will be used instead of the app's value.86 #:87 #: .. deprecated:: 2.288 #: Will be removed in Flask 2.3.89 json_decoder: t.Union[t.Type[json.JSONDecoder], None] = None9076 def __init__(77 self,78 import_name: str,79 static_folder: t.Optional[t.Union[str, os.PathLike]] = None,
842 unmodified lines
modified:tests/conftest.py-1 removed
18 unmodified lines
19 mp = monkeypatch.MonkeyPatch()20 out = (21 (os.environ, "FLASK_ENV_FILE", monkeypatch.notset),22 (os.environ, "FLASK_APP", monkeypatch.notset),23 (os.environ, "FLASK_ENV", monkeypatch.notset),23 (os.environ, "FLASK_DEBUG", monkeypatch.notset),24 (os.environ, "FLASK_RUN_FROM_CLI", monkeypatch.notset),25 (os.environ, "WERKZEUG_RUN_MAIN", monkeypatch.notset),26 )
172 unmodified lines
modified:tests/test_async.py-9 removed
93 unmodified lines
94 assert response.status_code == 412959697def test_async_before_after_request():98 app_first_called = False98 app_before_called = False99 app_after_called = False100 bp_before_called = False101 bp_after_called = False
3 unmodified lines
105 @app.route("/")106 def index():107 return ""108110 with pytest.deprecated_call():111112 @app.before_first_request113 async def before_first():114 nonlocal app_first_called115 app_first_called = True116109 @app.before_request110 async def before():111 nonlocal app_before_called112 app_before_called = True
24 unmodified lines
137 app.register_blueprint(blueprint, url_prefix="/bp")138139 test_client = app.test_client()140 test_client.get("/")149 assert app_first_called141 assert app_before_called142 assert app_after_called143 test_client.get("/bp/")144 assert bp_before_called
1 unmodified line
modified:tests/test_basic.py-39 removed
1import gc2import re3import time3import uuid4import warnings5import weakref6from datetime import datetime7from datetime import timezone8from platform import python_implementation10from threading import Thread910import pytest11import werkzeug.serving12from werkzeug.exceptions import BadRequest
1651 unmodified lines
16641665 assert "setup method 'add_url_rule'" in str(exc_info.value)166616671670def test_before_first_request_functions(app, client):1671 got = []16721673 with pytest.deprecated_call():16741675 @app.before_first_request1676 def foo():1677 got.append(42)16781679 client.get("/")1680 assert got == [42]1681 client.get("/")1682 assert got == [42]1683 assert app.got_first_request168416851686def test_before_first_request_functions_concurrent(app, client):1687 got = []16881689 with pytest.deprecated_call():16901691 @app.before_first_request1692 def foo():1693 time.sleep(0.2)1694 got.append(42)16951696 def get_and_assert():1697 client.get("/")1698 assert got == [42]16991700 t = Thread(target=get_and_assert)1701 t.start()1702 get_and_assert()1703 t.join()1704 assert app.got_first_request170517061668def test_routing_redirect_debugging(monkeypatch, app, client):1669 app.config["DEBUG"] = True16701671 @app.route("/user/", methods=["GET", "POST"])
248 unmodified lines
modified:tests/test_blueprints.py+2 added-8 removed
720 unmodified lines
721def test_app_request_processing(app, client):722 bp = flask.Blueprint("bp", __name__)723 evts = []724725 with pytest.deprecated_call():726727 @bp.before_app_first_request728 def before_first_request():729 evts.append("first")730725 @bp.before_app_request726 def before_app():727 evts.append("before")728
19 unmodified lines
748749 # first request750 resp = client.get("/").data751 assert resp == b"request|after"758 assert evts == ["first", "before", "after", "teardown"]752 assert evts == ["before", "after", "teardown"]753754 # second request755 resp = client.get("/").data756 assert resp == b"request|after"763 assert evts == ["first"] + ["before", "after", "teardown"] * 2757 assert evts == ["before", "after", "teardown"] * 2758759760def test_app_url_processors(app, client):761 bp = flask.Blueprint("bp", __name__)
287 unmodified lines
modified:tests/test_helpers.py+8 added-14 removed
300 unmodified lines
301302303class TestHelpers:304 @pytest.mark.parametrize(305 "debug, expected_flag, expected_default_flag",305 ("debug", "expect"),306 [307 ("", False, False),308 ("0", False, False),309 ("False", False, False),310 ("No", False, False),311 ("True", True, True),307 ("", False),308 ("0", False),309 ("False", False),310 ("No", False),311 ("True", True),312 ],313 )314 def test_get_debug_flag(315 self, monkeypatch, debug, expected_flag, expected_default_flag316 ):314 def test_get_debug_flag(self, monkeypatch, debug, expect):315 monkeypatch.setenv("FLASK_DEBUG", debug)318 if expected_flag is None:319 assert get_debug_flag() is None320 else:321 assert get_debug_flag() == expected_flag316 assert get_debug_flag() == expect322 assert get_debug_flag() == expected_default_flag317318 def test_make_response(self):319 app = flask.Flask(__name__)320 with app.test_request_context():
22 unmodified lines
modified:CHANGES.rst+18 added
1 unmodified line
2-------------34Unreleased56- Remove previously deprecated code. :pr:`4995`78 - The ``push`` and ``pop`` methods of the deprecated ``_app_ctx_stack`` and9 ``_request_ctx_stack`` objects are removed. ``top`` still exists to give10 extensions more time to update, but it will be removed.11 - The ``FLASK_ENV`` environment variable, ``ENV`` config key, and ``app.env``12 property are removed.13 - The ``session_cookie_name``, ``send_file_max_age_default``, ``use_x_sendfile``,14 ``propagate_exceptions``, and ``templates_auto_reload`` properties on ``app``15 are removed.16 - The ``JSON_AS_ASCII``, ``JSON_SORT_KEYS``, ``JSONIFY_MIMETYPE``, and17 ``JSONIFY_PRETTYPRINT_REGULAR`` config keys are removed.18 - The ``app.before_first_request`` and ``bp.before_app_first_request`` decorators19 are removed.20 - ``json_encoder`` and ``json_decoder`` attributes on app and blueprint, and the21 corresponding ``json.JSONEncoder`` and ``JSONDecoder`` classes, are removed.22 - The ``json.htmlsafe_dumps`` and ``htmlsafe_dump`` functions are removed.2324- Use modern packaging metadata with ``pyproject.toml`` instead of ``setup.cfg``.25 :pr:`4947`26- Ensure subdomains are applied with nested blueprints. :issue:`4834`27
1418 unmodified lines