#11441 closed (fixed)
Signal documentation should mention 'weak' parameter for connect
Reported by: | Mike_A | Owned by: | Brian Neal |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Keywords: | weak signal dispatch_uid docs | |
Cc: | Brian Neal | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In the documentation for signals: http://docs.djangoproject.com/en/dev/topics/signals/
No reference at all is made to the 'weak' parameter of connect.
This caused me to spend about an hour scratching my head as to why my signals didn't seem to work at all.
In the end I realised I needed to set this to False to stop the signal from dropping the callback and silently failing, but only after writing a debugging signal class.
Attachments (1)
Change History (13)
comment:1 by , 15 years ago
Version: | 1.0 → SVN |
---|
comment:2 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 14 years ago
There is already a short explanation for 'weak' here: http://docs.djangoproject.com/en/dev/ref/signals/#module-django.db.models.signals
If it should be set to False only for local functions, this explanation is sufficient.
On the other hand, the docs do not mention dispatch_uid at all. There is a note in the wiki, which could (should?) be moved to the signal documentation: http://code.djangoproject.com/wiki/Signals#Helppost_saveseemstobeemittedtwiceforeachsave
I found #3951 and that wiki page after a long pdb session, trying to understand why my handlers were called twice...
send_robust and disconnect only have docstrings, as far as I can tell. So currently it's RTFS :)
comment:4 by , 14 years ago
Cc: | added |
---|
comment:5 by , 14 years ago
Owner: | changed from | to
---|
comment:6 by , 14 years ago
Status: | new → assigned |
---|
I have worked up my first substantial patch for Django for this ticket. Be advised this was the first time I had used sphinx or made a documentation change. I'm hoping a committer can either give me feedback on the patch, or just use it as the basis to provide better words. :-)
I have attempted to document the weak and dispatch_uid arguments to Signal.connect().
I have also attempted to document Signal.send_robust() and Signal.disconnect().
I also fixed some typos in the docstrings of dispatch.py.
by , 14 years ago
Attachment: | patch11441-1.diff added |
---|
comment:7 by , 14 years ago
Has patch: | set |
---|
comment:8 by , 14 years ago
+1 on documenting dispatch_uid!
I'm willing to go as far as suggesting that dispatch_uid be made a required kwarg in order to prevent post_save signals being duplicated. It caused me over 24 hours of frustrating commits, rollbacks, and debugging...
comment:9 by , 14 years ago
Keywords: | dispatch_uid docs added |
---|
comment:10 by , 14 years ago
airstrike (or anyone else), I need someone to peer review my patch. If you are good with it, please mark this ticket's triage stage to "ready for checkin". Otherwise please leave comments on how I may improve it here. Thanks.
comment:11 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
AND dispatch_uid argument
AND send_robust function
AND disconnect function
;-)