Commit 2e0cae70 authored by Łukasz Nowak's avatar Łukasz Nowak

Support caching for instance list.

parent 214b5639
...@@ -387,6 +387,8 @@ class InstancePublisher(GenericPublisher): ...@@ -387,6 +387,8 @@ class InstancePublisher(GenericPublisher):
self.REQUEST.response.setBody(jsonify(d)) self.REQUEST.response.setBody(jsonify(d))
return self.REQUEST.response return self.REQUEST.response
software_instance_module = 'software_instance_module'
@supportModifiedSince('software_instance_module')
@requireHeader({'Accept': 'application/json'}) @requireHeader({'Accept': 'application/json'})
def __instance_list(self): def __instance_list(self):
kw = dict( kw = dict(
...@@ -402,6 +404,10 @@ class InstancePublisher(GenericPublisher): ...@@ -402,6 +404,10 @@ class InstancePublisher(GenericPublisher):
# no results, so nothing to return # no results, so nothing to return
self.REQUEST.response.setStatus(204) self.REQUEST.response.setStatus(204)
else: else:
self.REQUEST.response.setHeader('Last-Modified',
rfc1123_date(self.getPortalObject().software_instance_module\
.bobobase_modification_time()))
self.REQUEST.response.setHeader('Cache-Control', 'must-revalidate')
self.REQUEST.response.setStatus(200) self.REQUEST.response.setStatus(200)
self.REQUEST.response.setBody(jsonify(d)) self.REQUEST.response.setBody(jsonify(d))
return self.REQUEST.response return self.REQUEST.response
......
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