diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-05-26 19:28:55 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-05-26 19:28:55 +0000 |
| commit | c21acb6aeb80caab77166c55567da7fe86fbb0e5 (patch) | |
| tree | 956441ab4bb7aea69023dc54b0f248c36d1bcc7d | |
| parent | dc378e8ca7fd099ebf6fda37503db172d445c6d4 (diff) | |
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
| -rw-r--r-- | django/db/models/loading.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/django/db/models/loading.py b/django/db/models/loading.py index a9e0348f8e..7f5c97924b 100644 --- a/django/db/models/loading.py +++ b/django/db/models/loading.py @@ -17,9 +17,15 @@ def get_apps(): _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): |
