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
"""
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 portal.portal_workflow.isTransitionPossible(context, 'delete'):
parent = context.getParentValue()
try:
if parent.portal_type != 'Preference' and \
portal.portal_workflow.isTransitionPossible(context, 'delete'):
portal.portal_workflow.doActionFor(context, 'delete_action')
except ConflictError:
return errorHandler()
except Exception:
pass
else:
try:
context.getParentValue().manage_delObjects(
ids= [context.getId()])
parent.manage_delObjects(ids= [context.getId()])
return
except ConflictError:
return errorHandler()
raise
except Exception:
pass
else:
return errorHandler()
request = portal.REQUEST
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