Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#26778 closed Bug (fixed)

ModelSignal.connect() does not work when 'weak' is set to False and receiver is a local function

Reported by: laevilgenius Owned by: Tim Graham
Component: Database layer (models, ORM) Version: 1.10
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Since #26642 there seems to be a regression. ModelSignal.connect doesn't take into account 'weak' argument.

Quick fix might look like this:

  • django/db/models/signals.py

    a b class ModelSignal(Signal):  
    2727            return partial_method(sender)
    2828
    2929    def connect(self, receiver, sender=None, weak=True, dispatch_uid=None, apps=None):
    30         self._lazy_method(super(ModelSignal, self).connect, apps, receiver, sender, dispatch_uid=dispatch_uid)
     30        self._lazy_method(super(ModelSignal, self).connect, apps, receiver, sender, weak=weak, dispatch_uid=dispatch_uid)
    3131
    3232    def disconnect(self, receiver=None, sender=None, weak=None, dispatch_uid=None, apps=None):
    3333        if weak is not None:

Change History (4)

comment:1 by Tim Graham, 9 years ago

Needs tests: set
Owner: changed from nobody to Tim Graham
Severity: NormalRelease blocker
Status: newassigned
Triage Stage: UnreviewedAccepted
Version: master1.10

comment:2 by Tim Graham, 9 years ago

Needs tests: unset

comment:3 by GitHub <noreply@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In 9bf8d50a:

Fixed #26778 -- Fixed ModelSignal.connect() weak argument.

comment:4 by Tim Graham <timograham@…>, 9 years ago

In 91d754e:

[1.10.x] Fixed #26778 -- Fixed ModelSignal.connect() weak argument.

Backport of 9bf8d50a678463a5a3cd52f10c830fe0ca65d2c6 from master

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