django_sorcery.db.signals module

Signals

Implements some basic signals using blinker

class django_sorcery.db.signals.Namespace[source]

Bases: blinker.base.Namespace

A signal namespace that also manages scoped signals.

scoped_signals

Returns all scoped signals.

scopedsignal(name, doc=None)[source]

Returns the scoped signal for a given name.

class django_sorcery.db.signals.ScopedSignal(name, doc=None)[source]

Bases: blinker.base.NamedSignal

Same as NamedSignal but signal is scoped to a thread.

In other words, if a receiver is attached within a specific thread, even if signal is sent in another thread, in that other thread no receivers will be present and hence nothing will execute. Useful for adding one-off signal handlers for example to be executed at the end of unit-of-work (e.g. request) without adding a possibility that another thread might start executing the receiver.

cleanup()[source]

Cleans up signal for the current thread scope.

is_muted
receivers

Return all thread scoped receivers.