#15084: Unnecessary imports lead to ImportError
-------------------------------------------+--------------------------------
          Reporter:  vanschelven           |         Owner:  nobody
            Status:  new                   |     Milestone:        
         Component:  Internationalization  |       Version:  1.2   
        Resolution:                        |      Keywords:        
             Stage:  Accepted              |     Has_patch:  0     
        Needs_docs:  0                     |   Needs_tests:  0     
Needs_better_patch:  0                     |  
-------------------------------------------+--------------------------------
Comment (by vanschelven):

 Russell: by that logic every Error is a "Error reporting" problem. :-)

 Anyway, I've been trying for much too long again to recreate a clean
 environment in which this bug actually causes harm, to no avail.

 I can, however, confirm the following:

  1. In my production system, without patch, Django crashes with an
 !ImportError as described
  2. With Jeff's patch the project loads
  3. Adding some print statements/ logging seems to indicate that indeed
 the right paths are considered.


 As I said, I've started chopping parts off my project to get to try to
 isolate an exportable, isolated, problem, but not getting very far. I'm
 posting the Traceback (after adding a "raise" to
 django.core.management.base as decribed in #11667) here, in case this may
 be of use to someone:

 {{{

 Traceback (most recent call last):
   File "manage.py", line 11, in <module>
     execute_manager(settings)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/core/management/__init__.py", line 438, in execute_manager
     utility.execute()
   File "/home/klaas/dev/importerror/src/django-
 tip/django/core/management/__init__.py", line 379, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/core/management/base.py", line 191, in run_from_argv
     self.execute(*args, **options.__dict__)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/core/management/base.py", line 209, in execute
     translation.activate('en-us')
   File "/home/klaas/dev/importerror/src/django-
 tip/django/utils/translation/__init__.py", line 81, in activate
     return _trans.activate(language)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/utils/translation/trans_real.py", line 200, in activate
     _active[currentThread()] = translation(language)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/utils/translation/trans_real.py", line 183, in translation
     default_translation = _fetch(settings.LANGUAGE_CODE)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/utils/translation/trans_real.py", line 166, in _fetch
     app = import_module(appname)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/utils/importlib.py", line 35, in import_module
     __import__(name)
   File "/home/klaas/dev/importerror/src/online-apps-
 tip/numerology/__init__.py", line 1, in <module>
     from models import HasNumberFormat
   File "/home/klaas/dev/importerror/src/online-apps-
 tip/numerology/models.py", line 4, in <module>
     class HasTypedNumberFormat(models.Model):
   File "/home/klaas/dev/importerror/src/online-apps-
 tip/numerology/models.py", line 5, in HasTypedNumberFormat
     number = models.IntegerField(_("Number"))
   File "/home/klaas/dev/importerror/src/django-
 tip/django/utils/translation/__init__.py", line 62, in ugettext
     return _trans.ugettext(message)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/utils/translation/trans_real.py", line 283, in ugettext
     return do_translate(message, 'ugettext')
   File "/home/klaas/dev/importerror/src/django-
 tip/django/utils/translation/trans_real.py", line 273, in do_translate
     _default = translation(settings.LANGUAGE_CODE)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/utils/translation/trans_real.py", line 183, in translation
     default_translation = _fetch(settings.LANGUAGE_CODE)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/utils/translation/trans_real.py", line 166, in _fetch
     app = import_module(appname)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/utils/importlib.py", line 35, in import_module
     __import__(name)
   File "/home/klaas/dev/importerror/usesadmin/__init__.py", line 1, in
 <module>
     import admin
   File "/home/klaas/dev/importerror/usesadmin/admin.py", line 6, in
 <module>
     admin.site.register(Something, SomethingAdmin)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/contrib/admin/sites.py", line 90, in register
     validate(admin_class, model)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/contrib/admin/validation.py", line 21, in validate
     models.get_apps()
   File "/home/klaas/dev/importerror/src/django-
 tip/django/db/models/loading.py", line 115, in get_apps
     self._populate()
   File "/home/klaas/dev/importerror/src/django-
 tip/django/db/models/loading.py", line 61, in _populate
     self.load_app(app_name, True)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/db/models/loading.py", line 76, in load_app
     app_module = import_module(app_name)
   File "/home/klaas/dev/importerror/src/django-
 tip/django/utils/importlib.py", line 35, in import_module
     __import__(name)
   File "/home/klaas/dev/importerror/client/__init__.py", line 1, in
 <module>
     from numerology.models import HasTypedNumberFormat
 ImportError: cannot import name HasTypedNumberFormat

 }}}

 As far as I'm concerned, this is ready for checkin now.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15084#comment:8>
Django <http://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 django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to