Opened 10 years ago

Closed 10 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: dev
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

Description

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 10 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Marc Tamlyn, 10 years ago

Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

by Claude Paroz, 10 years ago

Attachment: 22236-1.diff added

comment:2 by Claude Paroz, 10 years ago

Has patch: set

comment:3 by Tim Graham, 10 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by Claude Paroz <claude@…>, 10 years ago

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