Commit ef6308db authored by Karen Tracey's avatar Karen Tracey
Browse files

[1.1.X] Fixed #13335: Adjusted the r12950 fix to properly handle import errors...

[1.1.X] 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/branches/releases/1.1.X@12973 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 65a9d730
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -74,16 +74,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)
            else:
                raise
        self.nesting_level -= 1
        if models not in self.app_store:
            self.app_store[models] = len(self.app_store)
+0 −0

Empty file added.

+0 −0

Empty file added.

+3 −0
Original line number Diff line number Diff line
from django.contrib import admin
from admin_scripts.complex_app.models.foo import Foo
admin.site.register(Foo)
+4 −0
Original line number Diff line number Diff line
from admin_scripts.complex_app.models.bar import Bar
from admin_scripts.complex_app.models.foo import Foo

__all__ = ['Foo', 'Bar']
Loading