Skip to content

Instantly share code, notes, and snippets.

@qoelet
Created May 20, 2010 07:27
Show Gist options
  • Save qoelet/407308 to your computer and use it in GitHub Desktop.
Save qoelet/407308 to your computer and use it in GitHub Desktop.
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