[Django] #33909: Signals docs omits **kwargs param to @receiver decorator?

14 views
Skip to first unread message

Django

unread,
Aug 9, 2022, 2:30:53 PM8/9/22
to django-...@googlegroups.com
#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.

Django

unread,
Aug 9, 2022, 9:24:16 PM8/9/22
to django-...@googlegroups.com
#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 | Resolution:

Keywords: signals | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by David Sanders):

> Would some tweaks to the docs along these lines be welcomed?

Hi Mike,

Yes documentation PRs are always welcome. Just FYI for minor documentation
updates such as this you can submit a PR without creating a ticket. :)

Refs:

- https://docs.djangoproject.com/en/4.1/internals/contributing/writing-
code/submitting-patches/#typo-fixes-and-trivial-documentation-changes
- Documentation on how to update the documentation:
https://docs.djangoproject.com/en/4.1/internals/contributing/writing-
documentation/

--
Ticket URL: <https://code.djangoproject.com/ticket/33909#comment:1>

Django

unread,
Aug 10, 2022, 1:35:00 AM8/10/22
to django-...@googlegroups.com
#33909: Signals docs omits **kwargs param to @receiver decorator?
--------------------------------------+------------------------------------

Reporter: Mike Lissner | Owner: nobody
Type: Cleanup/optimization | Status: new

Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: signals | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* type: New feature => Cleanup/optimization
* stage: Unreviewed => Accepted


Comment:

Agreed, we should at least correct the signature. Would you like to
prepare a patch?

--
Ticket URL: <https://code.djangoproject.com/ticket/33909#comment:2>

Django

unread,
Aug 15, 2022, 7:32:02 AM8/15/22
to django-...@googlegroups.com
#33909: Signals docs omits **kwargs param to @receiver decorator?
-------------------------------------+-------------------------------------
Reporter: Mike Lissner | Owner:
Type: | badziyoussef
Cleanup/optimization | Status: assigned

Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: signals | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by badziyoussef):

* owner: nobody => badziyoussef
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/33909#comment:3>

Django

unread,
Aug 16, 2022, 12:20:20 AM8/16/22
to django-...@googlegroups.com
#33909: Signals docs omits **kwargs param to @receiver decorator?
-------------------------------------+-------------------------------------
Reporter: Mike Lissner | Owner:
Type: | badziyoussef
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: signals | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* has_patch: 0 => 1
* stage: Accepted => Ready for checkin


Comment:

[https://github.com/django/django/pull/15961 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/33909#comment:4>

Django

unread,
Aug 16, 2022, 12:56:25 AM8/16/22
to django-...@googlegroups.com
#33909: Signals docs omits **kwargs param to @receiver decorator?
-------------------------------------+-------------------------------------
Reporter: Mike Lissner | Owner:
Type: | badziyoussef
Cleanup/optimization | Status: closed
Component: Documentation | Version: dev
Severity: Normal | Resolution: fixed

Keywords: signals | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"0cbbed49f4fbe60ddf9b452b310815708a64cc64" 0cbbed49]:
{{{
#!CommitTicketReference repository=""
revision="0cbbed49f4fbe60ddf9b452b310815708a64cc64"
Fixed #33909 -- Corrected django.dispatch.receiver() signature.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33909#comment:5>

Django

unread,
Aug 16, 2022, 12:57:51 AM8/16/22
to django-...@googlegroups.com
#33909: Signals docs omits **kwargs param to @receiver decorator?
-------------------------------------+-------------------------------------
Reporter: Mike Lissner | Owner:
Type: | badziyoussef
Cleanup/optimization | Status: closed
Component: Documentation | Version: dev
Severity: Normal | Resolution: fixed
Keywords: signals | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"bee09df39fe0734eb2388a2b3439436796592820" bee09df3]:
{{{
#!CommitTicketReference repository=""
revision="bee09df39fe0734eb2388a2b3439436796592820"
[4.1.x] Fixed #33909 -- Corrected django.dispatch.receiver() signature.

Backport of 0cbbed49f4fbe60ddf9b452b310815708a64cc64 from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33909#comment:6>

Reply all
Reply to author
Forward
0 new messages