summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-04-25 23:13:58 +0200
committerClaude Paroz <claude@2xlibre.net>2014-04-25 23:16:59 +0200
commitb4b63b3832896d00bd9bd9e15c00cb7f1f9ac3ad (patch)
treee095f2efbc61032dd1160c727498ec3c19eacb08
parente9c78435ab9cfd27d0815c244c9a1feb08cc18d1 (diff)
[1.6.x] Fixed #22507 -- Clarified nature of the sender argument of signals
Backport of d1f93e9c1e from master.
-rw-r--r--docs/topics/signals.txt9
1 files changed, 5 insertions, 4 deletions
diff --git a/docs/topics/signals.txt b/docs/topics/signals.txt
index a97fb2f14f..78d5a21f7d 100644
--- a/docs/topics/signals.txt
+++ b/docs/topics/signals.txt
@@ -227,7 +227,8 @@ For example:
This declares a ``pizza_done`` signal that will provide receivers with
``toppings`` and ``size`` arguments.
-Remember that you're allowed to change this list of arguments at any time, so getting the API right on the first try isn't necessary.
+Remember that you're allowed to change this list of arguments at any time, so
+getting the API right on the first try isn't necessary.
Sending signals
---------------
@@ -238,8 +239,8 @@ There are two ways to send signals in Django.
.. method:: Signal.send_robust(sender, **kwargs)
To send a signal, call either :meth:`Signal.send` or :meth:`Signal.send_robust`.
-You must provide the ``sender`` argument, and may provide as many other keyword
-arguments as you like.
+You must provide the ``sender`` argument (which is a class most of the time),
+and may provide as many other keyword arguments as you like.
For example, here's how sending our ``pizza_done`` signal might look:
@@ -249,7 +250,7 @@ For example, here's how sending our ``pizza_done`` signal might look:
...
def send_pizza(self, toppings, size):
- pizza_done.send(sender=self, toppings=toppings, size=size)
+ pizza_done.send(sender=self.__class__, toppings=toppings, size=size)
...
Both ``send()`` and ``send_robust()`` return a list of tuple pairs