Fixed #7922 -- admin.autodiscover() no longer eats ImportErrors for breakfast. Thanks Jan Rademaker and Alex Gaynor for their work on the ticket.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8174 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Brian Rosner 2008-08-01 19:10:55 +00:00
parent be17a801f6
commit 525e1e379a
1 changed files with 5 additions and 2 deletions

View File

@ -8,9 +8,12 @@ def autodiscover():
not present. This forces an import on them to register any admin bits they not present. This forces an import on them to register any admin bits they
may want. may want.
""" """
import imp
from django.conf import settings from django.conf import settings
for app in settings.INSTALLED_APPS: for app in settings.INSTALLED_APPS:
try: try:
__import__("%s.admin" % app) imp.find_module("admin", app.split("."))
except ImportError: except ImportError:
pass # there is no admin.py in app, skip it.
continue
__import__("%s.admin" % app)