Ticket #6677: django_conf_init.patch

File django_conf_init.patch, 1.3 KB (added by trbs, 17 years ago)
  • django/conf/__init__.py

     
    88
    99import os
    1010import time     # Needed for Windows
     11import sets
    1112from django.conf import global_settings
    1213
    1314ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
     
    99100
    100101        # Expand entries in INSTALLED_APPS like "django.contrib.*" to a list
    101102        # of all those apps.
    102         new_installed_apps = []
     103        new_installed_apps = sets.Set()
    103104        for app in self.INSTALLED_APPS:
    104105            if app.endswith('.*'):
    105106                appdir = os.path.dirname(__import__(app[:-2], {}, {}, ['']).__file__)
    106107                for d in os.listdir(appdir):
    107108                    if d.isalpha() and os.path.isdir(os.path.join(appdir, d)):
    108                         new_installed_apps.append('%s.%s' % (app[:-2], d))
     109                        new_installed_apps.add('%s.%s' % (app[:-2], d))
    109110            else:
    110                 new_installed_apps.append(app)
    111         self.INSTALLED_APPS = new_installed_apps
     111                new_installed_apps.add(app)
     112        self.INSTALLED_APPS = list(new_installed_apps)
    112113
    113114        if hasattr(time, 'tzset'):
    114115            # Move the time zone info into os.environ. See ticket #2315 for why
Back to Top