Commit 2feb0df1 authored by Roque's avatar Roque

erp5_hal_json_style: try catch in hateoas script for new actions handling

parent 385ff6cb
...@@ -1113,7 +1113,6 @@ def renderFormDefinition(form, response_dict): ...@@ -1113,7 +1113,6 @@ def renderFormDefinition(form, response_dict):
for field in form.get_fields_in_group(group['goid'], include_disabled=1): for field in form.get_fields_in_group(group['goid'], include_disabled=1):
field_list.append((field.id, {'meta_type': field.meta_type})) field_list.append((field.id, {'meta_type': field.meta_type}))
group_list.append((group['gid'], field_list)) group_list.append((group['gid'], field_list))
# some forms might not have any fields so we put empty bottom group # some forms might not have any fields so we put empty bottom group
...@@ -1358,13 +1357,19 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None, ...@@ -1358,13 +1357,19 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
for erp5_action_key in erp5_action_dict.keys(): for erp5_action_key in erp5_action_dict.keys():
erp5_action_list = [] erp5_action_list = []
for view_action in erp5_action_dict[erp5_action_key]: for view_action in erp5_action_dict[erp5_action_key]:
continue_iteration = True
# Action condition is probably checked in Base_filterDuplicateActions # Action condition is probably checked in Base_filterDuplicateActions
try:
erp5_action_list.append({ erp5_action_list.append({
'href': '%s' % view_action['url'], 'href': '%s' % view_action['url'],
'name': view_action['id'], 'name': view_action['id'],
'icon': view_action['icon'], 'icon': view_action['icon'],
'title': Base_translateString(view_action['title']) 'title': Base_translateString(view_action['title'])
}) })
except:
continue_iteration = False
if continue_iteration:
global_action_type = ("view", "workflow", "object_new_content_action", global_action_type = ("view", "workflow", "object_new_content_action",
"object_clone_action", "object_delete_action", "object_clone_action", "object_delete_action",
...@@ -2182,10 +2187,8 @@ try: ...@@ -2182,10 +2187,8 @@ try:
if "_embedded" in hateoas.keys() and "_view" in hateoas["_embedded"].keys() and "my_action" in hateoas["_embedded"]["_view"].keys(): if "_embedded" in hateoas.keys() and "_view" in hateoas["_embedded"].keys() and "my_action" in hateoas["_embedded"]["_view"].keys():
if hateoas["_embedded"]["_view"]["my_action"]["default"] == 'string:${object_url}/HTMLPost_viewAsJio' or hateoas["_embedded"]["_view"]["my_action"]["default"] == 'string:${object_url}/HTMLPost_view': if hateoas["_embedded"]["_view"]["my_action"]["default"] == 'string:${object_url}/HTMLPost_viewAsJio' or hateoas["_embedded"]["_view"]["my_action"]["default"] == 'string:${object_url}/HTMLPost_view':
hateoas["_embedded"]["_view"]["my_action"]["default"] = 'portal_skins/erp5_officejs_jio_connector/HTMLPost_viewAsJio' hateoas["_embedded"]["_view"]["my_action"]["default"] = 'portal_skins/erp5_officejs_jio_connector/HTMLPost_viewAsJio'
if hateoas["_embedded"]["_view"]["my_action"]["default"] == 'string:${object_url}/HTMLPost_viewReplyDialog': if hateoas["_embedded"]["_view"]["my_action"]["default"] == 'string:${object_url}/HTMLPost_viewReplyDialog':
hateoas["_embedded"]["_view"]["my_action"]["default"] = 'portal_skins/erp5_officejs_jio_connector/HTMLPost_viewReplyDialog' hateoas["_embedded"]["_view"]["my_action"]["default"] = 'portal_skins/erp5_officejs_jio_connector/HTMLPost_viewReplyDialog'
if hateoas["_embedded"]["_view"]["my_action"]["default"] == 'string:${object_url}/PostModule_newHTMLPost': if hateoas["_embedded"]["_view"]["my_action"]["default"] == 'string:${object_url}/PostModule_newHTMLPost':
hateoas["_embedded"]["_view"]["my_action"]["default"] = 'portal_skins/erp5_post/PostModule_newHTMLPost' hateoas["_embedded"]["_view"]["my_action"]["default"] = 'portal_skins/erp5_post/PostModule_newHTMLPost'
except: except:
......
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