Commit 0a4c8ed8 authored by Łukasz Nowak's avatar Łukasz Nowak

Fixup: setup headers on success.

Called method is setting up response code 503 in case of cache being empty. So
check it out before preparing success response.
parent a2da31b5
......@@ -303,8 +303,8 @@ class SlapTool(BaseTool):
self._logAccess(user, user, '#access %s' % computer_id)
result = self._getComputerInformation(computer_id, user, True)
if self.REQUEST.response.getStatus() == 200:
# Keep in cache server for 7 days
self.REQUEST.response.setStatus(200)
self.REQUEST.response.setHeader('Cache-Control',
'public, max-age=1, stale-if-error=604800')
self.REQUEST.response.setHeader('Vary',
......@@ -312,6 +312,8 @@ class SlapTool(BaseTool):
self.REQUEST.response.setHeader('Last-Modified', rfc1123_date(DateTime()))
self.REQUEST.response.setBody(result)
return self.REQUEST.response
else:
return result
security.declareProtected(Permissions.AccessContentsInformation,
'getComputerPartitionCertificate')
......
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