Ticket #9427: admin_autodiscover_impfix.patch

File admin_autodiscover_impfix.patch, 1.0 KB (added by clint, 16 years ago)

A patch to remove imp.find_module in admin.autodiscover

  • django/contrib/admin/__init__.py

     
    2525            app_path = __import__(app, {}, {}, [app.split('.')[-1]]).__path__
    2626        except AttributeError:
    2727            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.
    3331        try:
    34             imp.find_module('admin', app_path)
     32            __import__("%s.admin" % app)
    3533        except ImportError:
    3634            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)
Back to Top