summaryrefslogtreecommitdiff
path: root/django/contrib/admin/__init__.py
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2009-03-18 16:55:59 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2009-03-18 16:55:59 +0000
commitc485e236bd7e5ea40c64b2fe54d85dbb15b2fd39 (patch)
treefc5e86abf39b69181b2084f5c39038f1811b6b44 /django/contrib/admin/__init__.py
parentee2f04d79e5bca55637b9bb3301618738a4e342a (diff)
Fixed #8193: all dynamic imports in Django are now done correctly. I know this because Brett Cannon borrowed the time machine and brought Python 2.7's '`importlib` back for inclusion in Django. Thanks for the patch-from-the-future, Brett!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10088 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib/admin/__init__.py')
-rw-r--r--django/contrib/admin/__init__.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/contrib/admin/__init__.py b/django/contrib/admin/__init__.py
index bb856a1241..b2eeeebb1e 100644
--- a/django/contrib/admin/__init__.py
+++ b/django/contrib/admin/__init__.py
@@ -1,6 +1,7 @@
from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL
from django.contrib.admin.options import StackedInline, TabularInline
from django.contrib.admin.sites import AdminSite, site
+from django.utils.importlib import import_module
# A flag to tell us if autodiscover is running. autodiscover will set this to
# True while running, and False when it finishes.
@@ -36,7 +37,7 @@ def autodiscover():
# fails silently -- apps that do weird things with __path__ might
# need to roll their own admin registration.
try:
- app_path = __import__(app, {}, {}, [app.split('.')[-1]]).__path__
+ app_path = import_module(app).__path__
except AttributeError:
continue
@@ -51,6 +52,6 @@ def autodiscover():
# Step 3: import the app's admin file. If this has errors we want them
# to bubble up.
- __import__("%s.admin" % app)
+ import_module("%s.admin" % app)
# autodiscover was successful, reset loading flag.
LOADING = False