Commit c4641821 authored by Xiaowu Zhang's avatar Xiaowu Zhang Committed by Ayush Tiwari

hal_json_style&listbox: check if key is an object path

parent 5d770137
...@@ -1804,6 +1804,12 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None, ...@@ -1804,6 +1804,12 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
else: else:
contents_item[select][key] = url_parameter_dict[select][key] contents_item[select][key] = url_parameter_dict[select][key]
if 'jio_key' in contents_item[select]:
try:
portal.restrictedTraverse(contents_item[select]['jio_key'])
except KeyError:
contents_item[select]['jio_key'] = traversed_document.getRelativeUrl() + '/' + contents_item[select]['jio_key']
if 'jio_key' not in contents_item[select] and url_parameter_dict[select] and 'absolute_url' not in contents_item[select]: if 'jio_key' not in contents_item[select] and url_parameter_dict[select] and 'absolute_url' not in contents_item[select]:
contents_item[select]['jio_key'] = traversed_document.getRelativeUrl() contents_item[select]['jio_key'] = traversed_document.getRelativeUrl()
......
...@@ -2348,7 +2348,11 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine): ...@@ -2348,7 +2348,11 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
if 'jio_key' not in result_dict: if 'jio_key' not in result_dict:
url = '' url = ''
else: else:
try:
url = self.getObject().getPortalObject().restrictedTraverse(result_dict['jio_key']).absolute_url() url = self.getObject().getPortalObject().restrictedTraverse(result_dict['jio_key']).absolute_url()
except KeyError:
url = result_dict['jio_key']
if 'view_action' in result_dict: if 'view_action' in result_dict:
url += result_dict['view_action'] url += result_dict['view_action']
if 'parameter' not in result_dict and getattr(brain, 'getListItemParamDict', None) is not None: if 'parameter' not in result_dict and getattr(brain, 'getListItemParamDict', None) is not None:
......
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