Ticket #16247: 16247.diff

File 16247.diff, 2.4 KB (added by aaugustin, 4 years ago)
  • docs/releases/1.4.txt

     
    363363Some legacy ways of calling :func:`~django.views.decorators.cache.cache_page`
    364364have been deprecated, please see the docs for the correct way to use this
    365365decorator.
     366
     367Wildcard expansion of application names in `INSTALLED_APPS`
     368~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     369
     370Until Django 1.3, :setting:`INSTALLED_APPS` accepted wildcards in application
     371names, like ``django.contrib.*``. The expansion was performed by a crude
     372filesystem-based implementation of ``from <package> import *``. Unfortunately,
     373`this can't be done reliably`_.
     374
     375This behavior was never documented. Since it is prone to unexpected
     376side-effects, un-pythonic and not obviously useful, it was removed in Django
     3771.4. If you relied on it, you must edit your settings file to list all your
     378applications explicitly.
     379
     380.. _this can't be done reliably: http://docs.python.org/tutorial/modules.html#importing-from-a-package
  • django/conf/__init__.py

     
    9999                    setting_value = (setting_value,) # In case the user forgot the comma.
    100100                setattr(self, setting, setting_value)
    101101
    102         # Expand entries in INSTALLED_APPS like "django.contrib.*" to a list
    103         # of all those apps.
    104         new_installed_apps = []
    105         for app in self.INSTALLED_APPS:
    106             if app.endswith('.*'):
    107                 app_mod = importlib.import_module(app[:-2])
    108                 appdir = os.path.dirname(app_mod.__file__)
    109                 app_subdirs = os.listdir(appdir)
    110                 app_subdirs.sort()
    111                 name_pattern = re.compile(r'[a-zA-Z]\w*')
    112                 for d in app_subdirs:
    113                     if name_pattern.match(d) and os.path.isdir(os.path.join(appdir, d)):
    114                         new_installed_apps.append('%s.%s' % (app[:-2], d))
    115             else:
    116                 new_installed_apps.append(app)
    117         self.INSTALLED_APPS = new_installed_apps
    118 
    119102        if hasattr(time, 'tzset') and self.TIME_ZONE:
    120103            # When we can, attempt to validate the timezone. If we can't find
    121104            # this file, no check happens and it's harmless.
Back to Top