Skip to content
Myr

Clarify use of context-locals with signals.

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

authored by Ron DuPlain · committed by Ron DuPlain · parent b16c988 · Browse files · 1 file+13 added−0 removed
This commit

State

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

Diff stats

1 file+13 added−0 removed

  • other:+13 added−0 removed

1 file+13 added−0 removed

modified:docs/signals.rst+13 added
129 unmodified lines
130 If you are writing a Flask extension and you want to gracefully degrade for131 missing blinker installations, you can do so by using the132 :class:`flask.signals.Namespace` class.133134.. _signals-sending:135136Sending Signals137---------------138139If you want to emit a signal, you can do so by calling the
17 unmodified lines
157 ``current_app._get_current_object()`` instead. The reason for this is158 that :data:`~flask.current_app` is a proxy and not the real application159 object.160161162Signals and Flask's Request Context163-----------------------------------164165Signals fully support :ref:`reqcontext` when receiving signals. Context-local166variables are consistently available between :data:`~flask.request_started` and167:data:`~flask.request_finished`, so you can rely on :class:`flask.g` and others168as needed. Note the limitations described in :ref:`signals-sending` and the169:data:`~flask.request_tearing_down` signal.170171172Decorator Based Signal Subscriptions173------------------------------------174175With Blinker 1.1 you can also easily subscribe to signals by using the new
96 unmodified lines