Signals receivers not called when the receiver is a closure
Reported by: |
alek@… |
Owned by: |
|
Component:
|
Core (Other)
|
Version:
|
dev
|
Severity:
|
|
Keywords:
|
signals
|
Cc:
|
|
Triage Stage:
|
Unreviewed
|
Has patch:
|
no
|
Needs documentation:
|
no
|
Needs tests:
|
no
|
Patch needs improvement:
|
no
|
Easy pickings:
|
no
|
UI/UX:
|
no
|
>>> from django.db import models
>>> def x():
... def y(sender, **kwargs):
... print 'y called'
... models.signals.post_init.connect(y, sender = User)
...
>>> x()
>>>
>>> def z(sender, **kwargs):
... print 'z called'
...
>>> models.signals.post_init.connect(z, sender = User)
>>>
>>> a = User()
z called
>>>
Expected result:
>>> a = User()
y called
z called
>>>
Change History
(4)
Owner: |
changed from nobody to anonymous
|
Status: |
new → assigned
|
Owner: |
anonymous removed
|
Status: |
assigned → new
|
Resolution: |
→ invalid
|
Status: |
new → closed
|
That's not a bug, that's a feature.
def connect(self, receiver, sender=None, weak=True, dispatch_uid=None)
weak