blinker icon indicating copy to clipboard operation
blinker copied to clipboard

Temporarily mute signal

Open wronglink opened this issue 8 years ago • 0 comments

Sometimes you need to switch off particular signals for testing purposes. I guess this context manager would be more convenient way to solve such task:

# I have some signal
signal = blinker.Signal()

sig.send(123)  # it's been sent

with sig.muted():
    sig.send(456)  # it's muted and hasn't been sent

wronglink avatar Oct 13 '16 20:10 wronglink