Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
6702bb33
Commit
6702bb33
authored
Sep 14, 2011
by
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
api/util.py
View file @
6702bb33
...
...
@@ -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
)
...
...
@@ -210,6 +211,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'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment