summaryrefslogtreecommitdiff
path: root/django/dispatch/robust.py
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2006-07-21 20:48:17 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2006-07-21 20:48:17 +0000
commit1687b025dc2a03e9ef111b8fd3db63fce48b77b7 (patch)
treefd2ad4dcabc6adc57d5290e6a66be16661558ea9 /django/dispatch/robust.py
parenta926046ba633ac38d3306b6bc10677a670929786 (diff)
Part 3 of pedant day: replaced all tabs in Django with spaces. Python the way Guido intended it, baby!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3415 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/dispatch/robust.py')
-rw-r--r--django/dispatch/robust.py88
1 files changed, 44 insertions, 44 deletions
diff --git a/django/dispatch/robust.py b/django/dispatch/robust.py
index ba19934d43..8b1590de35 100644
--- a/django/dispatch/robust.py
+++ b/django/dispatch/robust.py
@@ -3,55 +3,55 @@ from django.dispatch.dispatcher import Any, Anonymous, liveReceivers, getAllRece
from django.dispatch.robustapply import robustApply
def sendRobust(
- signal=Any,
- sender=Anonymous,
- *arguments, **named
+ signal=Any,
+ sender=Anonymous,
+ *arguments, **named
):
- """Send signal from sender to all connected receivers catching errors
-
- signal -- (hashable) signal value, see connect for details
+ """Send signal from sender to all connected receivers catching errors
+
+ signal -- (hashable) signal value, see connect for details
- sender -- the sender of the signal
-
- if Any, only receivers registered for Any will receive
- the message.
+ sender -- the sender of the signal
+
+ if Any, only receivers registered for Any will receive
+ the message.
- if Anonymous, only receivers registered to receive
- messages from Anonymous or Any will receive the message
+ if Anonymous, only receivers registered to receive
+ messages from Anonymous or Any will receive the message
- Otherwise can be any python object (normally one
- registered with a connect if you actually want
- something to occur).
+ Otherwise can be any python object (normally one
+ registered with a connect if you actually want
+ something to occur).
- arguments -- positional arguments which will be passed to
- *all* receivers. Note that this may raise TypeErrors
- if the receivers do not allow the particular arguments.
- Note also that arguments are applied before named
- arguments, so they should be used with care.
+ arguments -- positional arguments which will be passed to
+ *all* receivers. Note that this may raise TypeErrors
+ if the receivers do not allow the particular arguments.
+ Note also that arguments are applied before named
+ arguments, so they should be used with care.
- named -- named arguments which will be filtered according
- to the parameters of the receivers to only provide those
- acceptable to the receiver.
+ named -- named arguments which will be filtered according
+ to the parameters of the receivers to only provide those
+ acceptable to the receiver.
- Return a list of tuple pairs [(receiver, response), ... ]
+ Return a list of tuple pairs [(receiver, response), ... ]
- if any receiver raises an error (specifically any subclass of Exception),
- the error instance is returned as the result for that receiver.
- """
- # Call each receiver with whatever arguments it can accept.
- # Return a list of tuple pairs [(receiver, response), ... ].
- responses = []
- for receiver in liveReceivers(getAllReceivers(sender, signal)):
- try:
- response = robustApply(
- receiver,
- signal=signal,
- sender=sender,
- *arguments,
- **named
- )
- except Exception, err:
- responses.append((receiver, err))
- else:
- responses.append((receiver, response))
- return responses
+ if any receiver raises an error (specifically any subclass of Exception),
+ the error instance is returned as the result for that receiver.
+ """
+ # Call each receiver with whatever arguments it can accept.
+ # Return a list of tuple pairs [(receiver, response), ... ].
+ responses = []
+ for receiver in liveReceivers(getAllReceivers(sender, signal)):
+ try:
+ response = robustApply(
+ receiver,
+ signal=signal,
+ sender=sender,
+ *arguments,
+ **named
+ )
+ except Exception, err:
+ responses.append((receiver, err))
+ else:
+ responses.append((receiver, response))
+ return responses