summaryrefslogtreecommitdiff
path: root/docs/source/signals.rst
diff options
context:
space:
mode:
authorjason kirtland <jek@discorporate.us>2010-07-21 11:07:13 +0100
committerjason kirtland <jek@discorporate.us>2010-07-21 11:07:13 +0100
commitfa3be696ab410308191ed4af804a31d2ba60144d (patch)
tree3cfd919986622a0d5857967480d4c95d7e69cc2c /docs/source/signals.rst
parent50ac3faf7d154b6bd57ed3341dae3a31cab82013 (diff)
downloadblinker-fa3be696ab410308191ed4af804a31d2ba60144d.tar.gz
Added Signal.connect_via() decorator.
Diffstat (limited to 'docs/source/signals.rst')
-rw-r--r--docs/source/signals.rst14
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/source/signals.rst b/docs/source/signals.rst
index 8bb967a..b17338f 100644
--- a/docs/source/signals.rst
+++ b/docs/source/signals.rst
@@ -184,7 +184,19 @@ be used as a decorator on functions:
While convenient, this form unfortunately does not allow the
``sender`` or ``weak`` arguments to be customized for the connected
-function.
+function. For this, :meth:`~Signal.connect_via` can be used:
+
+.. doctest::
+
+ >>> dice_roll = signal('dice_roll')
+ >>> @dice_roll.connect_via(1)
+ ... @dice_roll.connect_via(3)
+ ... @dice_roll.connect_via(5)
+ ... def odd_subscriber(sender):
+ ... print("Observed dice roll %r." % sender)
+ ...
+ >>> result = dice_roll.send(3)
+ Observed dice roll 3.
Optimizing Signal Sending