From 31eb0fbe3d16418cafd907e333207431dc49cdd0 Mon Sep 17 00:00:00 2001
From: Adrian Holovaty <adrian@holovaty.com>
Date: Sun, 10 Jan 2010 18:56:53 +0000
Subject: [PATCH] Fixed #10887 -- Fixed a possible gotcha in
 admin.autodiscover() by moving import_module() outside the try/except.
 Thanks, lsaffre

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12192 bcc190cf-cafb-0310-a4f2-bffc1f526a37
---
 django/contrib/admin/__init__.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/django/contrib/admin/__init__.py b/django/contrib/admin/__init__.py
index 8105976591..abc5f09b56 100644
--- a/django/contrib/admin/__init__.py
+++ b/django/contrib/admin/__init__.py
@@ -37,8 +37,9 @@ def autodiscover():
         # should) bubble up, but a missing __path__ (which is legal, but weird)
         # fails silently -- apps that do weird things with __path__ might
         # need to roll their own admin registration.
+        mod = import_module(app)
         try:
-            app_path = import_module(app).__path__
+            app_path = mod.__path__
         except AttributeError:
             continue