#35564: Improve readability of subclass identification in admin and auth checks
------------------------------------------------+--------------------------
               Reporter:  Jaap Roes             |          Owner:  nobody
                   Type:  Cleanup/optimization  |         Status:  assigned
              Component:  Core (System checks)  |        Version:  dev
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  0
                  UI/UX:  0                     |
------------------------------------------------+--------------------------
 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:

 
[https://github.com/django/django/blob/e56a32b89bb7fadffdfaa2cdf12b4863ccd5af9b/django/contrib/admin/checks.py#L19-L44
 _contains_subclass] and
 
[https://github.com/django/django/blob/e56a32b89bb7fadffdfaa2cdf12b4863ccd5af9b/django/contrib/auth/checks.py#L12-L25
 _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.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35564>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107019056815757-633ac397-54b6-493f-8978-379aff4d28b1-000000%40eu-central-1.amazonses.com.

Reply via email to