Created
May 20, 2010 07:27
-
-
Save qoelet/407308 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def send(self, sender, **named): | |
""" | |
Send signal from sender to all connected receivers. | |
If any receiver raises an error, the error propagates back through send, | |
terminating the dispatch loop, so it is quite possible to not have all | |
receivers called if a raises an error. | |
Arguments: | |
sender | |
The sender of the signal Either a specific object or None. | |
named | |
Named arguments which will be passed to receivers. | |
Returns a list of tuple pairs [(receiver, response), ... ]. | |
""" | |
responses = [] | |
if not self.receivers: | |
return responses | |
for receiver in self._live_receivers(_make_id(sender)): | |
response = receiver(signal=self, sender=sender, **named) | |
responses.append((receiver, response)) | |
return responses |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment