Changes between Initial Version and Version 1 of Ticket #11696


Ignore:
Timestamp:
Aug 13, 2009, 10:48:06 AM (15 years ago)
Author:
Karen Tracey
Comment:

This looks to be due to r10088, which changed:

        self.nesting_level += 1
        mod = __import__(app_name, {}, {}, ['models'])
        self.nesting_level -= 1
        if not hasattr(mod, 'models'):

to:

        self.nesting_level += 1
        try:
            models = import_module('.models', app_name)
        except ImportError:
            self.nesting_level -= 1

in django/db/models/loading.py

The new code's try/except ImportError is not equivalent to the old code's testing if the returned mod has a 'models' attribute, as the new code now swallows import errors that the old code used to raise.

I have no idea how to fix it, though, since I don't know what would be equivalent to what the old code did when using the new import_module.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #11696

    • Property Triage Stage UnreviewedAccepted
  • Ticket #11696 – Description

    initial v1  
    11Given a trivial error in a model, running "django manage.py validate" with Django 1.0.2 diagnoses the error, a spelling error/typo, very clearly (traceback trimmed, obviously):
    2 
     2{{{
    33  File "/home/rocketry/rocketry/../rocketry/event/models.py", line 5, in <module>[[br]]
    44    from django.contrib.contentypes.models import ContentType[[br]]
    55ImportError: No module named contentypes.models
    6 
     6}}}
    77With Django 1.1, it does its damndest to make you think there's something wrong in a completely different direction, making diagnosis damned near impossible:
    88
Back to Top