Opened 3 years ago

Closed 3 years ago

#22236 closed Cleanup/optimization (fixed)

Gratuitous and inappropriate use of signals

Reported by: Aymeric Augustin Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Currently, django.db.models.manager contains signals.class_prepared.connect(ensure_default_manager).

But ModelBase._prepare is the only method to send class_prepared. It should simply call ensure_default_manager (and still send the signal for other receivers).

There's no reason for obfuscating control flow with signals.

Attachments (1)

22236-1.diff (3.0 KB) - added by Claude Paroz 3 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 3 years ago by Marc Tamlyn

Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

Changed 3 years ago by Claude Paroz

Attachment: 22236-1.diff added

comment:2 Changed 3 years ago by Claude Paroz

Has patch: set

comment:3 Changed 3 years ago by Tim Graham

Triage Stage: AcceptedReady for checkin

comment:4 Changed 3 years ago by Claude Paroz <claude@…>

Resolution: fixed
Status: newclosed

In 0a65da941c1643f0ce8d2c9644b12d3f07319c6d:

Fixed #22236 -- Removed inappropriate usage of signals

Thanks Aymeric Augustin for the report and Tim Graham for the review.

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