#36864: Automatic shell imports cannot reliably handle submodules
-------------------------------------+-------------------------------------
     Reporter:  Jacob Walls          |                    Owner:  Jacob
                                     |  Walls
         Type:  Bug                  |                   Status:  assigned
    Component:  Core (Management     |                  Version:  5.2
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:  import_string,       |             Triage Stage:  Accepted
  submodule                          |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Timothy Schilling):

 Looking at
 
[https://github.com/pallets/werkzeug/blame/eba894a6401a3e9d28f843ee90b2861662085c10/src/werkzeug/utils.py#L590
 werkzeug's implementation], it hasn't been touched in the last 6 years.
 Based on that, I'd say the risk of follow-up changes to extend
 `import_string` is low. While someone could be making use of
 `import_string` failing to import modules, it seems a bit unlikely
 especially considering it sometimes work and Jacob didn't mention tickets
 about people complaining about that inconsistency.

 The failure mode I could see from making this more flexible is
 `import_string` fails to raise an exception and instead returns a  module
 instead of the expected attribute/class. That seems like something that
 would quickly crop up in CI and is unlikely to unexpectedly make its way
 into a production web app.

 For me, my preference would be to extend `import_string` to work with
 modules since we have a stable reference point to base it on and the
 downsides are both minimal and seem unlikely.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36864#comment:5>
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 visit 
https://groups.google.com/d/msgid/django-updates/0107019c95321b0b-e8a3da35-e12c-44ea-9d28-f77fbb40cf8d-000000%40eu-central-1.amazonses.com.

Reply via email to