app/django/conf/__init__.py
changeset 323 ff1a9aa48cfd
parent 54 03e267d67478
equal deleted inserted replaced
322:6641e941ef1e 323:ff1a9aa48cfd
    69         holder = UserSettingsHolder(default_settings)
    69         holder = UserSettingsHolder(default_settings)
    70         for name, value in options.items():
    70         for name, value in options.items():
    71             setattr(holder, name, value)
    71             setattr(holder, name, value)
    72         self._target = holder
    72         self._target = holder
    73 
    73 
       
    74     def configured(self):
       
    75         """
       
    76         Returns True if the settings have already been configured.
       
    77         """
       
    78         return bool(self._target)
       
    79     configured = property(configured)
       
    80 
    74 class Settings(object):
    81 class Settings(object):
    75     def __init__(self, settings_module):
    82     def __init__(self, settings_module):
    76         # update this dict from global settings (but only for ALL_CAPS settings)
    83         # update this dict from global settings (but only for ALL_CAPS settings)
    77         for setting in dir(global_settings):
    84         for setting in dir(global_settings):
    78             if setting == setting.upper():
    85             if setting == setting.upper():
   101         # of all those apps.
   108         # of all those apps.
   102         new_installed_apps = []
   109         new_installed_apps = []
   103         for app in self.INSTALLED_APPS:
   110         for app in self.INSTALLED_APPS:
   104             if app.endswith('.*'):
   111             if app.endswith('.*'):
   105                 appdir = os.path.dirname(__import__(app[:-2], {}, {}, ['']).__file__)
   112                 appdir = os.path.dirname(__import__(app[:-2], {}, {}, ['']).__file__)
   106                 for d in os.listdir(appdir):
   113                 app_subdirs = os.listdir(appdir)
       
   114                 app_subdirs.sort()
       
   115                 for d in app_subdirs:
   107                     if d.isalpha() and os.path.isdir(os.path.join(appdir, d)):
   116                     if d.isalpha() and os.path.isdir(os.path.join(appdir, d)):
   108                         new_installed_apps.append('%s.%s' % (app[:-2], d))
   117                         new_installed_apps.append('%s.%s' % (app[:-2], d))
   109             else:
   118             else:
   110                 new_installed_apps.append(app)
   119                 new_installed_apps.append(app)
   111         self.INSTALLED_APPS = new_installed_apps
   120         self.INSTALLED_APPS = new_installed_apps