#32317: Clean up loaddata
-------------------------------------+-------------------------------------
               Reporter:  William    |          Owner:  William Schwartz
  Schwartz                           |
                   Type:             |         Status:  assigned
  Cleanup/optimization               |
              Component:  Core       |        Version:  master
  (Management commands)              |
               Severity:  Normal     |       Keywords:  loaddata
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 In `django.core.management.commands.Command`, `load_label` is 66 lines
 long with maximum indentation of 9 levels (the row starts at column 37).
 `find_fixtures` is 56 lines. These monolith methods are hard to read, hard
 to override, and, in some places, violate
 [https://www.python.org/dev/peps/pep-0008/#programming-recommendations
 PEP-8's recommendation] to keep `try` blocks small.

 The reason I care about this is that an app I'm working on may need to
 customize how `loaddata` finds fixtures, and, unlike templates, there
 isn't a nice loader API to hook into. So that leaves me with overriding
 `find_fixtures`. My initial attempt was a mess because of how giant the
 parent class's method is.

 I am submitting PR #XXX with my proposed refactoring. The commits will
 need to be squashed before merging the PR, but I wanted to include commit
 message to justify some of the less obvious-looking changes.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32317>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.2aebe6a8bd177b58c4d324ef9e4609e0%40djangoproject.com.

Reply via email to