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
Labels
Merge Requests
16
Merge Requests
16
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
9c62e2b5
Commit
9c62e2b5
authored
May 24, 2022
by
Cédric Le Ninivin
Committed by
Cédric Le Ninivin
Mar 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_slap_tool: Add getJIOAPIUrl to slapTool
parent
808c942c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
0 deletions
+98
-0
master/bt5/slapos_slap_tool/PropertySheetTemplateItem/portal_property_sheets/SlapOSHateoasSystemPreference/preferred_jio_api_url_property.xml
...ateoasSystemPreference/preferred_jio_api_url_property.xml
+71
-0
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.py
...onentTemplateItem/portal_components/tool.erp5.SlapTool.py
+27
-0
No files found.
master/bt5/slapos_slap_tool/PropertySheetTemplateItem/portal_property_sheets/SlapOSHateoasSystemPreference/preferred_jio_api_url_property.xml
0 → 100644
View file @
9c62e2b5
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Standard Property"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_local_properties
</string>
</key>
<value>
<tuple>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
mode
</string>
</value>
</item>
<item>
<key>
<string>
type
</string>
</key>
<value>
<string>
string
</string>
</value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/string
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Stores API server URL
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
preferred_jio_api_url_property
</string>
</value>
</item>
<item>
<key>
<string>
mode
</string>
</key>
<value>
<string>
w
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
</item>
<item>
<key>
<string>
preference
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
property_default
</string>
</key>
<value>
<string>
python: \'\'
</string>
</value>
</item>
<item>
<key>
<string>
read_permission
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
write_permission
</string>
</key>
<value>
<string>
Manage properties
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.py
View file @
9c62e2b5
...
@@ -416,6 +416,33 @@ class SlapTool(BaseTool):
...
@@ -416,6 +416,33 @@ class SlapTool(BaseTool):
if
software_release
.
getValidationState
()
in
\
if
software_release
.
getValidationState
()
in
\
[
'published'
,
'published_alive'
]])
[
'published'
,
'published_alive'
]])
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getJIOAPIUrl'
)
def
getJIOAPIUrl
(
self
):
"""
Return preferred jIO API URL.
"""
preference_tool
=
self
.
getPortalObject
().
portal_preferences
try
:
url
=
CachingMethod
(
preference_tool
.
getPreferredJioApiUrl
,
id
=
'getJIOAPIUrl'
,
cache_factory
=
'slap_cache_factory'
)()
except
AttributeError
:
raise
NotFound
if
not
url
:
raise
NotFound
# Keep in cache server for 1 hour
self
.
REQUEST
.
response
.
setStatus
(
200
)
self
.
REQUEST
.
response
.
setHeader
(
'Cache-Control'
,
'public, max-age=3600, stale-if-error=604800'
)
self
.
REQUEST
.
response
.
setHeader
(
'Vary'
,
'REMOTE_USER'
)
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
)
return
self
.
REQUEST
.
response
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getHateoasUrl'
)
'getHateoasUrl'
)
def
getHateoasUrl
(
self
):
def
getHateoasUrl
(
self
):
...
...
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