Commit 6702bb33 authored by Giorgos Verigakis's avatar Giorgos Verigakis
Browse files

Prevent caching in API methods

Django's add_never_cache_headers will add @Cache-Control: max-age=0@ to the responses.
parent c195e424
......@@ -50,6 +50,7 @@ from django.conf import settings
from django.http import HttpResponse
from django.template.loader import render_to_string
from django.utils import simplejson as json
from django.utils.cache import add_never_cache_headers
from synnefo.api.faults import (Fault, BadRequest, BuildInProgress,
ItemNotFound, ServiceUnavailable, Unauthorized)
......@@ -211,6 +212,9 @@ def update_response_headers(request, response):
if settings.TEST:
response['Date'] = format_date_time(time())
add_never_cache_headers(response)
def render_metadata(request, metadata, use_values=False, status=200):
if request.serialization == 'xml':
data = render_to_string('metadata.xml', {'metadata': metadata})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment