#15084: Unnecessary imports lead to ImportError
--------------------------------------+------------------------------------
Reporter: vanschelven | Owner: nobody
Type: Bug | Status: reopened
Component: Internationalization | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by vanschelven):
Well yes, there are a number of things to be said against the example I
came up with. Besides the use of uggettext as opposed to ugettext_lazy you
could point at the fact that so much happens in __init__.py or the fact
that one could 'work around' the problem by reversing the order of the
INSTALLED_APPS.
However, I think we should strive for Django to be forgiving to its users'
preferences and to fail in predictable and understandable ways. And I dare
to say an !ImportError should not be the perfectionists' answer to using
ugettext in a class definition.
Remember the only reason Django is currently doing the import is to figure
out where the apps are so it can tuck 'locale' at the end and look for .mo
files there.
Doing frivolous imports in a framework is a Bad Idea (tm)
--
Ticket URL: <https://code.djangoproject.com/ticket/15084#comment:22>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.