Commit a9c3f613 authored by Xiaowu Zhang's avatar Xiaowu Zhang Committed by Julien Muchembled

erp5_hal_json_style: ConflictError must never be catched

parent a2122c35
...@@ -6,30 +6,23 @@ intended to make code easy understanding ...@@ -6,30 +6,23 @@ intended to make code easy understanding
""" """
portal = context.getPortalObject() portal = context.getPortalObject()
request=container.REQUEST
def errorHandler():
request.RESPONSE.setStatus(400)
form = getattr(context,form_id)
return context.ERP5Document_getHateoas(form=form, REQUEST=request, mode='form')
if context.isDeletable(check_relation=True): if context.isDeletable(check_relation=True):
if portal.portal_workflow.isTransitionPossible(context, 'delete'): parent = context.getParentValue()
try: try:
if parent.portal_type != 'Preference' and \
portal.portal_workflow.isTransitionPossible(context, 'delete'):
portal.portal_workflow.doActionFor(context, 'delete_action') portal.portal_workflow.doActionFor(context, 'delete_action')
except ConflictError: else:
return errorHandler() parent.manage_delObjects(ids= [context.getId()])
except Exception: return
pass except ConflictError:
else: raise
try: except Exception:
context.getParentValue().manage_delObjects( pass
ids= [context.getId()])
except ConflictError:
return errorHandler()
except Exception:
pass
else: request = portal.REQUEST
return errorHandler() request.RESPONSE.setStatus(400)
form = getattr(context,form_id)
return context.ERP5Document_getHateoas(form=form, REQUEST=request, mode='form')
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