diff options
| author | Karen Tracey <kmtracey@gmail.com> | 2010-04-14 19:10:27 +0000 |
|---|---|---|
| committer | Karen Tracey <kmtracey@gmail.com> | 2010-04-14 19:10:27 +0000 |
| commit | 48dd5f13a351048d40803cbb95e60ed775d980cd (patch) | |
| tree | 783277b6ddcdbf9199691ea7224d73bd078677a7 /django/db/models/loading.py | |
| parent | d8910e95e02f3eae279691e33c0ad1a2442676a0 (diff) | |
Fixed #13335: Adjusted the r12950 fix to properly handle import errors resulting from nested calls to load_app.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12972 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/loading.py')
| -rw-r--r-- | django/db/models/loading.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/django/db/models/loading.py b/django/db/models/loading.py index 06ddd7a4e4..d9c338f15d 100644 --- a/django/db/models/loading.py +++ b/django/db/models/loading.py @@ -75,16 +75,23 @@ class AppCache(object): app_module = import_module(app_name) try: imp.find_module('models', app_module.__path__) + except ImportError: + self.nesting_level -= 1 + # App has no models module, that's not a problem. + return None + try: + models = import_module('.models', app_name) except ImportError: self.nesting_level -= 1 if can_postpone: - # Either the app has no models, or the package is still being + # Either the app has an error, or the package is still being # imported by Python and the model module isn't available yet. # We will check again once all the recursion has finished (in # populate). self.postponed.append(app_name) - return None - models = import_module('.models', app_name) + return None + else: + raise self.nesting_level -= 1 if models not in self.app_store: self.app_store[models] = len(self.app_store) |
