Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #1732 -- AttributeErrors in models are no longer ignored by the…

… model validator.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2995 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c21acb6aeb80caab77166c55567da7fe86fbb0e5 1 parent dc378e8
Adrian Holovaty authored May 26, 2006

Showing 1 changed file with 9 additions and 3 deletions. Show diff stats Hide diff stats

  1. 12  django/db/models/loading.py
12  django/db/models/loading.py
@@ -17,9 +17,15 @@ def get_apps():
17 17
     _app_list = []
18 18
     for app_name in settings.INSTALLED_APPS:
19 19
         try:
20  
-            _app_list.append(__import__(app_name, '', '', ['models']).models)
21  
-        except (ImportError, AttributeError), e:
22  
-            pass
  20
+            mod = __import__(app_name, '', '', ['models'])
  21
+        except ImportError:
  22
+            pass # Assume this app doesn't have a models.py in it.
  23
+                 # GOTCHA: It may have a models.py that raises ImportError.
  24
+        else:
  25
+            try:
  26
+                _app_list.append(mod.models)
  27
+            except AttributeError:
  28
+                pass # This app doesn't have a models.py in it.
23 29
     return _app_list
24 30
 
25 31
 def get_app(app_label):

0 notes on commit c21acb6

Please sign in to comment.
Something went wrong with that request. Please try again.