при обращении к http://127.0.0.1:8000/test
происходит ошибка AttributeError: ‘SafeString’ object has no attribute ‘has_header’ с чем это связанно и как бороть этот ‘has_header’ ? изучаю тему Процессоры RequestContext и Context
code views.py
from django.template import loader, RequestContext
def custom_proc(request):
return {
‘app’: ‘My app’,
‘user’: request.user,
}
def view_1(request):
t = loader.get_template('template1.html')
c = RequestContext(request, {'message': ‘I am view 1.’},
processors=)
return t.render©
_______________________
в urls.py code:
from django.conf.urls.defaults import *
from django.views.generic import *
from django.shortcuts import *
from django.http import *
from mysite.books.models import *
from mysite.books.views import *
from django.core.context_processors import *
urlpatterns = patterns('',
(r'^test$', view_1)
)
__________________
Traceback (most recent call last):
File “/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py”, line 277, in run
self.result = application(self.environ, self.start_response)
File “/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py”, line 631, in __call__
return self.application(environ, start_response)
File “/usr/lib/python2.5/site-packages/django/core/handlers/wsgi.py”, line 209, in __call__
response = middleware_method(request, response)
File “/usr/lib/python2.5/site-packages/django/contrib/sessions/middleware.py”, line 27, in process_response
patch_vary_headers(response, ('Cookie',))
File “/usr/lib/python2.5/site-packages/django/utils/cache.py”, line 129, in patch_vary_headers
if response.has_header('Vary'):
AttributeError: ‘SafeString’ object has no attribute ‘has_header’