Commit caf8eb1a authored by Ayush Tiwari's avatar Ayush Tiwari

[erp5_hal_json_style]: Explicity update url_value dict

parent 6cb0628c
...@@ -1956,7 +1956,6 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None, ...@@ -1956,7 +1956,6 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
if not isinstance(contents_item[select], dict): if not isinstance(contents_item[select], dict):
contents_item[select] = { contents_item[select] = {
'default': contents_item[select], 'default': contents_item[select],
'editable': False
} }
# We should be generating view if there is extra params for view in # 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 # view_kw. These parameters are required to create url at hateoas side
...@@ -1970,12 +1969,13 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None, ...@@ -1970,12 +1969,13 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
if extra_url_param_dict: if extra_url_param_dict:
url_template_id = 'traverse_generator_action' url_template_id = 'traverse_generator_action'
contents_item[select]['url_value'] = { # Explicity populate url_value dict. This way we can ensure that whatever been
'command': url_parameter_dict['command'], # sent via url_parameter_dict goes directly in url_value dict
'options': { contents_item[select]['url_value'] = {}
'jio_key': url_parameter_dict.get('options', {}).get('jio_key', url_parameter_dict['view_kw']['jio_key']), contents_item[select]['url_value']['command'] = url_parameter_dict['command']
'editable': url_parameter_dict.get('options', {}).get('editable', None), contents_item[select]['url_value']['options'] = url_parameter_dict['options']
'view': url_template_dict[url_template_id] % { # 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(), "root_url": site_root.absolute_url(),
"script_id": script.id, "script_id": script.id,
"relative_url": url_parameter_dict['view_kw']['jio_key'].replace("/", "%2F"), "relative_url": url_parameter_dict['view_kw']['jio_key'].replace("/", "%2F"),
...@@ -1983,8 +1983,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None, ...@@ -1983,8 +1983,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
"extra_param_json": urlsafe_b64encode( "extra_param_json": urlsafe_b64encode(
json.dumps(ensureSerializable(extra_url_param_dict))) json.dumps(ensureSerializable(extra_url_param_dict)))
} }
}
}
# endfor select # endfor select
REQUEST.other.pop('cell', None) REQUEST.other.pop('cell', None)
contents_list.append(contents_item) contents_list.append(contents_item)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment