#22236 closed Cleanup/optimization (fixed)

Gratuitous and inappropriate use of signals

Reported by: aaugustin 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

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 claudep 11 months ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 12 months ago by mjtamlyn

  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Bug to Cleanup/optimization

Changed 11 months ago by claudep

comment:2 Changed 11 months ago by claudep

  • Has patch set

comment:3 Changed 11 months ago by timo

  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 11 months ago by Claude Paroz <claude@…>

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

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