In the docs here https://docs.djangoproject.com/en/1.8/topics/signals
/#preventing-duplicate-signals It implies that a receiver can be called
multiple times for the same event. When would this happen? Is it still a
problem in 1.8?
--
Ticket URL: <https://code.djangoproject.com/ticket/24816>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_docs: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_better_patch: => 0
Comment:
The ticket tracker is for tracking known problems, not asking questions.
If you want to ask a question about usage, please use the Django-users
mailing list.
However; to answer your question: Yes, it is still a problem, and no,
there isn't much we can do about it (other than what is already listed in
in the docs). The problem is that due to Python's import process, it's
possible for the same module to be imported twice, resulting in a handler
being registered twice.
--
Ticket URL: <https://code.djangoproject.com/ticket/24816#comment:1>
* component: Core (Other) => Documentation
Comment:
The reason `timkofu` has raised this ticket was because coming into IRC to
find out what the circumstances were didn't yield definitive results, and
while the phrasing of the original ticket may have left you thinking it
was a question for django-users, it's not, really. Given I was the one
suggesting opening a ticket to get the docs improved, I'm going to chime
in.
I have no idea what '''In some circumstances, the code connecting
receivers to signals may run multiple times''' might mean, these days,
given much of the problem stemmed (IIRC) from the old project layout
allowing for multiple import paths, and the lack of something like
AppConfig.ready.
If it is still a problem, as has been alluded to, the nature of how
multiple runs might be encountered ought to be documented rather than
just hand-waving it away as "''in some circumstances''" and leaving the
user wondering why they need `dispatch_uid`. There used to be a whole Wiki
page devoted to the issue; I'd hope if it's still an issue, some of the
explanation therein could be subsumed into the actual docs.
(Or just drop the whole bit entirely and document signals as taking a
dispatch_uid everywhere, given that is essentially the solution (and has
been for as long as I can remember))
I'm reclassifying this as documentation improvement, in the hope that it
could be re-opened on that basis.
--
Ticket URL: <https://code.djangoproject.com/ticket/24816#comment:2>
* cc: django@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/24816#comment:3>
* status: closed => new
* resolution: invalid =>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/24816#comment:4>
* owner: nobody => Jason Held
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/24816#comment:5>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/13131 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/24816#comment:6>
* needs_better_patch: 1 => 0
* version: 1.8 => 3.1
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/24816#comment:7>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"639142e24d41c5e5a508cb1280f32fd7ff159cca" 639142e2]:
{{{
#!CommitTicketReference repository=""
revision="639142e24d41c5e5a508cb1280f32fd7ff159cca"
Fixed #24816 -- Clarified docs about preventing duplicate signals.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24816#comment:8>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"703256fc681338bc227768a15c1f56851d05adae" 703256f]:
{{{
#!CommitTicketReference repository=""
revision="703256fc681338bc227768a15c1f56851d05adae"
[3.1.x] Fixed #24816 -- Clarified docs about preventing duplicate signals.
Backport of 639142e24d41c5e5a508cb1280f32fd7ff159cca from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24816#comment:9>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"3ca2361d70b003019e4135413bdcc800bcbf99e5" 3ca2361d]:
{{{
#!CommitTicketReference repository=""
revision="3ca2361d70b003019e4135413bdcc800bcbf99e5"
[3.0.x] Fixed #24816 -- Clarified docs about preventing duplicate signals.
Backport of 639142e24d41c5e5a508cb1280f32fd7ff159cca from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24816#comment:10>