On 7/1/07, Merric Mercer <[EMAIL PROTECTED]> wrote: > I want to change the Cache-Control on the HTTP header. Can anybody > advise how I do this. Currently my view returns > a render_to_response like so:- > > return render_to_response(template_name,{'code': code > },context_instance=RequestContext(request))
You have two options: make a decorator that alters the return as needed, or don't use render_to_response. The first option: def alter_headers(f, headers): def alter_response(**kwargs): r = f(kwargs) for header in headers: f[header]=headers[header] return r return alter_response --- @alter_headers({'Cache-Control':'private'}) def your_view(request,your_args): ... The second option: render_to_response is just a shortcut; you can create your own django.http.HttpResponse: http://www.djangoproject.com/documentation/request_response/#httpresponse-objects IMHO, the second option is simpler and more flexible. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---