Ticket #9427: admin_autodiscover_impfix2.patch
File admin_autodiscover_impfix2.patch, 1.5 KB (added by , 16 years ago) |
---|
-
django/contrib/admin/__init__.py
25 25 app_path = __import__(app, {}, {}, [app.split('.')[-1]]).__path__ 26 26 except AttributeError: 27 27 continue 28 29 # Step 2: use imp.find_module to find the app's admin.py. For some 30 # reason imp.find_module raises ImportError if the app can't be found 31 # but doesn't actually try to import the module. So skip this app if 32 # its admin.py doesn't exist 28 29 # Import the app's admin file. If this has errors we want them 30 # to bubble up. Import first because imp.find_module seems to have 31 # problems finding files inside of eggs. 33 32 try: 34 imp.find_module('admin', app_path)33 __import__("%s.admin" % app) 35 34 except ImportError: 36 continue 37 38 # Step 3: import the app's admin file. If this has errors we want them 39 # to bubble up. 40 __import__("%s.admin" % app) 35 # If we could not import the admin file, see if it exsits 36 try: 37 imp.find_module('admin', app_path) 38 # Raise hell 39 raise 40 except ImportError: 41 # If the file couldn't be imported and doesn't exist just move on. 42 continue