Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
107
Merge Requests
107
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
b1e92198
Commit
b1e92198
authored
Jul 13, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the way of fetching API root.
API is not an object, so generate virtual URLs.
parent
53cefc00
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
master/bt5/vifib_slapos_rest_api_v1/DocumentTemplateItem/portal_components/VifibRestAPIV1.py
.../DocumentTemplateItem/portal_components/VifibRestAPIV1.py
+10
-4
master/bt5/vifib_slapos_rest_api_v1/bt/revision
master/bt5/vifib_slapos_rest_api_v1/bt/revision
+1
-1
No files found.
master/bt5/vifib_slapos_rest_api_v1/DocumentTemplateItem/portal_components/VifibRestAPIV1.py
View file @
b1e92198
...
...
@@ -176,7 +176,7 @@ def responseSupport(anonymous=False):
# force login
self
.
REQUEST
.
response
.
setStatus
(
401
)
self
.
REQUEST
.
response
.
setHeader
(
'WWW-Authenticate'
,
'Bearer realm="%s"'
%
self
.
absolute_url
())
self
.
getAPIRoot
())
self
.
REQUEST
.
response
.
setHeader
(
'Location'
,
self
.
getPortalObject
()
\
.
portal_preferences
.
getPreferredRestApiTokenServerUrl
())
return
self
.
REQUEST
.
response
...
...
@@ -374,8 +374,8 @@ class InstancePublisher(GenericPublisher):
"connection"
:
software_instance
.
getConnectionXmlAsDict
(),
"parameter"
:
software_instance
.
getInstanceXmlAsDict
(),
"sla"
:
software_instance
.
getSlaXmlAsDict
(),
"children_list"
:
[
q
.
absolute_url
()
for
q
in
\
software_instance
.
getPredecessorValueList
()],
"children_list"
:
[
self
.
getAPIRoot
()
+
'/'
+
q
.
getRelativeUrl
()
\
for
q
in
software_instance
.
getPredecessorValueList
()],
"partition"
:
{
# not ready yet
"public_ip"
:
[],
"private_ip"
:
[],
...
...
@@ -410,7 +410,7 @@ class InstancePublisher(GenericPublisher):
d
=
{
"list"
:
[]}
a
=
d
[
'list'
].
append
for
si
in
self
.
getPortalObject
().
portal_catalog
(
**
kw
):
a
(
'/'
.
join
([
self
.
absolute_url
(),
'instance'
,
si
.
getRelativeUrl
()]))
a
(
'/'
.
join
([
self
.
getAPIRoot
(),
'instance'
,
si
.
getRelativeUrl
()]))
try
:
d
[
'list'
][
0
]
except
IndexError
:
...
...
@@ -504,6 +504,12 @@ class VifibRestAPIV1(Implicit):
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declarePublic
(
'instance'
)
security
.
declarePublic
(
'getAPIRoot'
)
def
getAPIRoot
(
self
):
"""Returns the root of API"""
return
self
.
absolute_url
()
+
'/v1'
@
ComputedAttribute
def
instance
(
self
):
"""Instance publisher"""
...
...
master/bt5/vifib_slapos_rest_api_v1/bt/revision
View file @
b1e92198
11
\ No newline at end of file
12
\ No newline at end of file
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