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
Boxiang Sun
slapos.core
Commits
7f1d298e
Commit
7f1d298e
authored
Nov 05, 2014
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos.core: Change Base_getHateoasMaster about 'me' link.
parent
65b98642
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
slapos/slap/slap.py
slapos/slap/slap.py
+15
-1
No files found.
slapos/slap/slap.py
View file @
7f1d298e
...
@@ -837,7 +837,13 @@ class HateoasNavigator(object):
...
@@ -837,7 +837,13 @@ class HateoasNavigator(object):
# XXX rename to be more generic
# XXX rename to be more generic
def
_hateoasGetPerson
(
self
):
def
_hateoasGetPerson
(
self
):
person_link
=
self
.
_hateoasGetMaster
()[
'_links'
][
'action_object_jump'
][
'href'
]
hateoas_master
=
self
.
_hateoasGetMaster
()
# XXX how to properly get URLs from URNs?
person_path
=
self
.
getPathFromUrn
(
hateoas_master
[
'_links'
][
'me'
][
'href'
])
hateoas_master_url
=
hateoas_master
[
'_links'
][
'self'
][
'href'
]
root_url
=
hateoas_master_url
[:
hateoas_master_url
.
rfind
(
'/'
)
+
1
]
person_link
=
'%s%s'
%
(
root_url
,
person_path
)
result
=
self
.
GET
(
person_link
)
result
=
self
.
GET
(
person_link
)
return
json
.
loads
(
result
)
return
json
.
loads
(
result
)
...
@@ -871,6 +877,14 @@ class HateoasNavigator(object):
...
@@ -871,6 +877,14 @@ class HateoasNavigator(object):
else
:
else
:
raise
NotFoundError
(
'Action %s not found.'
%
title
)
raise
NotFoundError
(
'Action %s not found.'
%
title
)
def
getPathFromUrn
(
self
,
urn
):
urn_schema
=
'urn:jio:get:'
try
:
_
,
url
=
urn
.
split
(
urn_schema
)
except
ValueError
:
return
return
str
(
url
)
# XXX remove me
# XXX remove me
def
_hateoas_getActionObjectSlap
(
self
,
action_object_slap_list
,
action_title
):
def
_hateoas_getActionObjectSlap
(
self
,
action_object_slap_list
,
action_title
):
return
self
.
hateoasGetLinkFromLinks
(
action_object_slap_list
,
action_title
)
return
self
.
hateoasGetLinkFromLinks
(
action_object_slap_list
,
action_title
)
...
...
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