#33909: Signals docs omits **kwargs param to @receiver decorator?
-----------------------------------------+-------------------------
Reporter: Mike Lissner | Owner: nobody
Type: New feature | Status: new
Component: Documentation | Version: dev
Severity: Normal | Keywords: signals
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-----------------------------------------+-------------------------
Looking at the Signals docs:
https://docs.djangoproject.com/en/dev/topics/signals/#preventing-
duplicate-signals
I was confused what parameters I could give to the @receiver decorator.
The docs just say that it takes one parameter, the signal:
{{{
@receiver(request_finished)
def my_callback(sender, **kwargs):
print("Request finished!")
}}}
But I think it should show:
{{{
@receiver(request_finished, **kwargs)
def my_callback(sender, **kwargs):
print("Request finished!")
}}}
And explain that kwargs can be any of the arguments that you can pass to a
manual connection. I learned this by looking at the code, which is very
simple:
https://docs.djangoproject.com/en/dev/_modules/django/dispatch/dispatcher/#receiver
The reason this came up for me was that I was trying to figure out how to
add a dispatch_uid parameter to the @receiver decorator, and it's not
documented how to do so (ya just add it).
Would some tweaks to the docs along these lines be welcomed?
--
Ticket URL: <https://code.djangoproject.com/ticket/33909>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018283dfadee-4a4272f2-ff24-4986-9e55-e54edd3323e3-000000%40eu-central-1.amazonses.com.