Ticket #7015: appsettings.patch

File appsettings.patch, 1.4 KB (added by Joshua "jag" Ginsberg <jag@…>, 17 years ago)
  • django/conf/__init__.py

     
    142142
    143143settings = LazySettings()
    144144
     145class ApplicationSettings(object):
     146
     147    def __init__(self, app_name):
     148        self.app_name = app_name.upper()
     149
     150    def __getattribute__(self, attr):
     151        if attr == 'app_name':
     152            return super(ApplicationSettings, self).__getattribute__('app_name')
     153        global_name = '%s_%s' % (self.app_name, attr)
     154        return getattr(settings, global_name,
     155                       super(ApplicationSettings, self).__getattribute__(attr))
  • django/conf/app_template/__init__.py

     
     1import app_settings
     2
     3settings = app_settings.LocalApplicationSettings('{{ app_name }}')
  • django/conf/app_template/app_settings.py

     
     1from django.conf import settings, ApplicationSettings
     2
     3class LocalApplicationSettings(ApplicationSettings):
     4    # Put your application specific settings here.
Back to Top