#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 , 17 months ago
| Has patch: | set |
|---|
comment:2 by , 16 months ago
| Owner: | changed from to |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:3 by , 16 months ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Thank you, agree this is nicer 👍