Clarify use of context-locals with signals.
This commit is contained in:
parent
b16c988f1e
commit
492ef06bff
1 changed files with 13 additions and 0 deletions
|
|
@ -131,6 +131,8 @@ debugging. You can access the name of the signal with the
|
||||||
missing blinker installations, you can do so by using the
|
missing blinker installations, you can do so by using the
|
||||||
:class:`flask.signals.Namespace` class.
|
:class:`flask.signals.Namespace` class.
|
||||||
|
|
||||||
|
.. _signals-sending:
|
||||||
|
|
||||||
Sending Signals
|
Sending Signals
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
|
@ -156,6 +158,17 @@ function, you can pass ``current_app._get_current_object()`` as sender.
|
||||||
that :data:`~flask.current_app` is a proxy and not the real application
|
that :data:`~flask.current_app` is a proxy and not the real application
|
||||||
object.
|
object.
|
||||||
|
|
||||||
|
|
||||||
|
Signals and Flask's Request Context
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
Signals fully support :ref:`reqcontext` when receiving signals. Context-local
|
||||||
|
variables are consistently available between :data:`~flask.request_started` and
|
||||||
|
:data:`~flask.request_finished`, so you can rely on :class:`flask.g` and others
|
||||||
|
as needed. Note the limitations described in :ref:`signals-sending` and the
|
||||||
|
:data:`~flask.request_tearing_down` signal.
|
||||||
|
|
||||||
|
|
||||||
Decorator Based Signal Subscriptions
|
Decorator Based Signal Subscriptions
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue