Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#12032 closed (invalid)

Signals receivers not called when the receiver is a closure

Reported by: alek@… Owned by:
Component: Core (Other) Version: master
Severity: Keywords: signals
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 Changed 6 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to anonymous
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:2 Changed 6 years ago by anonymous

  • Owner anonymous deleted
  • Status changed from assigned to new

comment:3 Changed 6 years ago by dc

  • Resolution set to invalid
  • Status changed from new to closed

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 Changed 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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