Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
erp5
Commits
caf8eb1a
Commit
caf8eb1a
authored
May 14, 2018
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_hal_json_style]: Explicity update url_value dict
parent
6cb0628c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
15 deletions
+14
-15
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+14
-15
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
caf8eb1a
...
...
@@ -1956,7 +1956,6 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
if
not
isinstance
(
contents_item
[
select
],
dict
):
contents_item
[
select
]
=
{
'default'
:
contents_item
[
select
],
'editable'
:
False
}
# We should be generating view if there is extra params for view in
# view_kw. These parameters are required to create url at hateoas side
...
...
@@ -1970,21 +1969,21 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
if
extra_url_param_dict
:
url_template_id
=
'traverse_generator_action'
contents_item
[
select
][
'url_value'
]
=
{
'command'
:
url_parameter_dict
[
'command'
],
'options'
:
{
'jio_key'
:
url_parameter_dict
.
get
(
'options'
,
{}).
get
(
'jio_key'
,
url_parameter_dict
[
'view_kw'
][
'jio_key'
]),
'editable'
:
url_parameter_dict
.
get
(
'options'
,
{}).
get
(
'editable'
,
None
),
'view'
:
url_template_dict
[
url_template_id
]
%
{
"root_url"
:
site_root
.
absolute_url
(),
"script_id"
:
script
.
id
,
"relative_url"
:
url_parameter_dict
[
'view_kw'
][
'jio_key'
].
replace
(
"/"
,
"%2F"
)
,
"view"
:
url_parameter_dict
[
'view_kw'
][
'view'
]
,
"extra_param_json"
:
urlsafe_b64encode
(
json
.
dumps
(
ensureSerializable
(
extra_url_param_dict
)))
}
# Explicity populate url_value dict. This way we can ensure that whatever been
# sent via url_parameter_dict goes directly in url_value dict
contents_item
[
select
][
'url_value'
]
=
{}
contents_item
[
select
][
'url_value'
][
'command'
]
=
url_parameter_dict
[
'command'
]
contents_item
[
select
][
'url_value'
][
'options'
]
=
url_parameter_dict
[
'options'
]
# Generate `view` to be used to construct URL
contents_item
[
select
][
'url_value'
][
'options'
][
'view'
]
=
url_template_dict
[
url_template_id
]
%
{
"root_url"
:
site_root
.
absolute_url
()
,
"script_id"
:
script
.
id
,
"relative_url"
:
url_parameter_dict
[
'view_kw'
][
'jio_key'
].
replace
(
"/"
,
"%2F"
)
,
"view"
:
url_parameter_dict
[
'view_kw'
][
'view'
],
"extra_param_json"
:
urlsafe_b64encode
(
json
.
dumps
(
ensureSerializable
(
extra_url_param_dict
)))
}
}
# endfor select
REQUEST
.
other
.
pop
(
'cell'
,
None
)
contents_list
.
append
(
contents_item
)
...
...
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