Opened 6 months ago

Closed 6 months ago

Last modified 6 months ago

#35564 closed Cleanup/optimization (fixed)

Improve readability of subclass identification in admin and auth checks

Reported by: Jaap Roes Owned by: Jaap Roes
Component: Core (System checks) 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

While researching some code for another ticket I noticed noticed that the contrib.admin and contrib.auth checks modules have a very similar, but slightly different, bits of code:

_contains_subclass and _subclass_index.

It took some careful reading, but they behave exactly the same, apart from one returning an index and the other a boolean.

I have a contribution that change these implementations, with the intent to make it easier to follow the flow.

I tried to find a place in the Django codebase to have a shared implementation, but I haven't been able to identify one. It would be nice to have a canonical implementation of these functions.

Change History (5)

comment:1 by Jaap Roes, 6 months ago

Has patch: set

comment:2 by Sarah Boyce, 6 months ago

Owner: changed from nobody to Jaap Roes
Triage Stage: UnreviewedAccepted

Thank you, agree this is nicer 👍

comment:3 by Sarah Boyce, 6 months ago

Triage Stage: AcceptedReady for checkin

comment:4 by Sarah Boyce <42296566+sarahboyce@…>, 6 months ago

Resolution: fixed
Status: assignedclosed

In f0d05a74:

Fixed #35564 -- Improved readability of subclass identification.

comment:5 by Sarah Boyce <42296566+sarahboyce@…>, 6 months ago

In 8cfcf9a3:

Reverted "Fixed #35564 -- Improved readability of subclass identification."

This reverts commit f0d05a747f7a099e6c6bc58c42a787546d2212e7 due to a performance regression.

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