Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#12032 closed (invalid)

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

Description

>>> 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)

comment:1 by anonymous, 15 years ago

Owner: changed from nobody to anonymous
Status: newassigned

comment:2 by anonymous, 15 years ago

Owner: anonymous removed
Status: assignednew

comment:3 by dc, 15 years ago

Resolution: invalid
Status: newclosed

That's not a bug, that's a feature.

def connect(self, receiver, sender=None, weak=True, dispatch_uid=None)

weak

Whether to use weak references to the receiver By default, the
module will attempt to use weak references to the receiver
objects. If this parameter is false, then strong references will
be used.

comment:4 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top