Ticket #6793: exported_settings_processor.diff
File exported_settings_processor.diff, 2.4 KB (added by , 17 years ago) |
---|
-
django/conf/global_settings.py
156 156 'django.core.context_processors.debug', 157 157 'django.core.context_processors.i18n', 158 158 'django.core.context_processors.media', 159 'django.core.context_processors.exported_settings', 159 160 # 'django.core.context_processors.request', 160 161 ) 161 162 -
django/core/context_processors.py
60 60 def request(request): 61 61 return {'request': request} 62 62 63 def exported_settings(request): 64 context_extras = {} 65 e = getattr(settings, 'EXPORTED', None) 66 if not e: 67 return context_extras 68 69 for field in e.fields: 70 context_extras[field[0]] = field[1] 71 return context_extras 72 63 73 # PermWrapper and PermLookupDict proxy the permissions system into objects that 64 74 # the template system can understand. 65 75 -
docs/settings.txt
138 138 139 139 The only place you should assign to settings is in a settings file. 140 140 141 Using settings in templates 142 =========================== 143 144 Define a class called EXPORTED with the fields attribute set 145 to an iterable of pairs. The first component is the template 146 variable name, and the second is the value. For example: 147 148 class EXPORTED: 149 fields = ( ('foo', 'bar'), ('images_url', MEDIA_URL + '/images/')) 150 151 Note that this feature depends on RequestContext. 152 See the `RequestContext docs`_ for more information. 153 154 .. _RequestContext docs: ../templates_python/#subclassing-context-requestcontext 155 141 156 Security 142 157 ======== 143 158 … … 907 922 ("django.core.context_processors.auth", 908 923 "django.core.context_processors.debug", 909 924 "django.core.context_processors.i18n", 910 "django.core.context_processors.media") 925 "django.core.context_processors.media", 926 "django.core.context_processors.exported_settings") 911 927 912 928 A tuple of callables that are used to populate the context in ``RequestContext``. 913 929 These callables take a request object as their argument and return a dictionary