Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos.core
Commits
bf53a921
Commit
bf53a921
authored
Jul 24, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_slap_tool: Cache for getHateoas for one hour
parent
8c6fceeb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.py
...onentTemplateItem/portal_components/tool.erp5.SlapTool.py
+4
-3
No files found.
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.py
View file @
bf53a921
...
@@ -562,14 +562,15 @@ class SlapTool(BaseTool):
...
@@ -562,14 +562,15 @@ class SlapTool(BaseTool):
raise
NotFound
raise
NotFound
if
not
url
:
if
not
url
:
raise
NotFound
raise
NotFound
# Keep in cache server for
7 days
# Keep in cache server for
1 hour
self
.
REQUEST
.
response
.
setStatus
(
200
)
self
.
REQUEST
.
response
.
setStatus
(
200
)
self
.
REQUEST
.
response
.
setHeader
(
'Cache-Control'
,
self
.
REQUEST
.
response
.
setHeader
(
'Cache-Control'
,
'public, max-age=
1
, stale-if-error=604800'
)
'public, max-age=
3600
, stale-if-error=604800'
)
self
.
REQUEST
.
response
.
setHeader
(
'Vary'
,
self
.
REQUEST
.
response
.
setHeader
(
'Vary'
,
'REMOTE_USER'
)
'REMOTE_USER'
)
self
.
REQUEST
.
response
.
setHeader
(
'Last-Modified'
,
rfc1123_date
(
DateTime
()))
self
.
REQUEST
.
response
.
setHeader
(
'content-type'
,
'text; charset=utf-8'
)
self
.
REQUEST
.
response
.
setHeader
(
'content-type'
,
'text; charset=utf-8'
)
self
.
REQUEST
.
response
.
setHeader
(
'Etag'
,
calculate_dict_hash
({
"etag"
:
url
}))
self
.
REQUEST
.
response
.
setBody
(
url
)
self
.
REQUEST
.
response
.
setBody
(
url
)
return
self
.
REQUEST
.
response
return
self
.
REQUEST
.
response
...
...
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