Ticket #13335: 13335.diff

File 13335.diff, 1.3 KB (added by Karen Tracey, 15 years ago)
  • django/db/models/loading.py

     
    7575        app_module = import_module(app_name)
    7676        try:
    7777            imp.find_module('models', app_module.__path__)
     78        except ImportError:
     79            self.nesting_level -= 1
     80            # App has no models module, that's not a problem.
     81            return None
     82        try:
     83            models = import_module('.models', app_name)
    7884        except ImportError:
    7985            self.nesting_level -= 1
    8086            if can_postpone:
    81                 # Either the app has no models, or the package is still being
     87                # Either the app has an error, or the package is still being
    8288                # imported by Python and the model module isn't available yet.
    8389                # We will check again once all the recursion has finished (in
    8490                # populate).
    8591                self.postponed.append(app_name)
    86             return None
    87         models = import_module('.models', app_name)
     92                return None
     93            else:
     94                raise
    8895        self.nesting_level -= 1
    8996        if models not in self.app_store:
    9097            self.app_store[models] = len(self.app_store)
Back to Top