Author: adrian
Date: 2006-05-26 14:28:55 -0500 (Fri, 26 May 2006)
New Revision: 2995

Modified:
   django/trunk/django/db/models/loading.py
Log:
Fixed #1732 -- AttributeErrors in models are no longer ignored by the model 
validator.

Modified: django/trunk/django/db/models/loading.py
===================================================================
--- django/trunk/django/db/models/loading.py    2006-05-26 19:02:23 UTC (rev 
2994)
+++ django/trunk/django/db/models/loading.py    2006-05-26 19:28:55 UTC (rev 
2995)
@@ -17,9 +17,15 @@
     _app_list = []
     for app_name in settings.INSTALLED_APPS:
         try:
-            _app_list.append(__import__(app_name, '', '', ['models']).models)
-        except (ImportError, AttributeError), e:
-            pass
+            mod = __import__(app_name, '', '', ['models'])
+        except ImportError:
+            pass # Assume this app doesn't have a models.py in it.
+                 # GOTCHA: It may have a models.py that raises ImportError.
+        else:
+            try:
+                _app_list.append(mod.models)
+            except AttributeError:
+                pass # This app doesn't have a models.py in it.
     return _app_list
 
 def get_app(app_label):


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---

Reply via email to