Ticket #7922: 7922.diff

File 7922.diff, 1.6 KB (added by Jan Rademaker <j.rademaker@…>, 7 years ago)
  • tests/regressiontests/admin_autodiscover/admin.py

     
     1raise ImportError('From inside admin.py')
  • tests/regressiontests/admin_autodiscover/tests.py

     
     1r"""
     2>>> from django.contrib import admin
     3>>> admin.autodiscover()
     4Traceback (most recent call last):
     5...
     6ImportError: From inside admin.py
     7"""
  • django/contrib/admin/__init__.py

     
    88    not present. This forces an import on them to register any admin bits they
    99    may want.
    1010    """
     11    from sys import exc_info
     12    from traceback import extract_tb
    1113    from django.conf import settings
    1214    for app in settings.INSTALLED_APPS:
    1315        try:
    1416            __import__("%s.admin" % app)
    1517        except ImportError:
    16             pass
     18            exc = exc_info()
     19            if len(extract_tb(exc[-1], 2)) > 1:
     20                raise
Back to Top