remove deprecated RequestContext.g

This commit is contained in:
David Lord 2022-07-01 13:44:31 -07:00
parent 96d39c87a8
commit 9e686d93b6
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
2 changed files with 4 additions and 26 deletions

View File

@ -5,6 +5,10 @@ Version 2.2.0
Unreleased Unreleased
- Remove previously deprecated code. :pr:`4337`
- The ``RequestContext.g`` proxy to ``AppContext.g`` is removed.
- Add new customization points to the ``Flask`` app object for many - Add new customization points to the ``Flask`` app object for many
previously global behaviors. previously global behaviors.

View File

@ -327,32 +327,6 @@ class RequestContext:
# functions. # functions.
self._after_request_functions: t.List[ft.AfterRequestCallable] = [] self._after_request_functions: t.List[ft.AfterRequestCallable] = []
@property
def g(self) -> _AppCtxGlobals:
import warnings
warnings.warn(
"Accessing 'g' on the request context is deprecated and"
" will be removed in Flask 2.2. Access `g` directly or from"
"the application context instead.",
DeprecationWarning,
stacklevel=2,
)
return _app_ctx_stack.top.g
@g.setter
def g(self, value: _AppCtxGlobals) -> None:
import warnings
warnings.warn(
"Setting 'g' on the request context is deprecated and"
" will be removed in Flask 2.2. Set it on the application"
" context instead.",
DeprecationWarning,
stacklevel=2,
)
_app_ctx_stack.top.g = value
def copy(self) -> "RequestContext": def copy(self) -> "RequestContext":
"""Creates a copy of this request context with the same request object. """Creates a copy of this request context with the same request object.
This can be used to move a request context to a different greenlet. This can be used to move a request context to a different greenlet.