Commit 22bdcd89 authored by Georgios Dagkakis's avatar Georgios Dagkakis

erp5_core: Do not pass in whatever Exception in Folder_delete

instead, check for the specifically expected Exception
and in that case return with a warning

Commit updates also testDelete of listbox_zuite accordingly
parent bc212c6a
......@@ -8254,6 +8254,9 @@ msgstr "Sans comptes non mouvementés"
msgid "On <a href=\"${decision_url}\">${decision_type} ${decision_title}</a> of <a href=\"${delivery_url}\">${delivery_title}</a> :"
msgstr "<a href=\"${decision_url}\">${decision_type} ${decision_title}</a> de <a href=\"${delivery_url}\">${delivery_title}</a>: "
msgid "One or more documents could not be deleted."
msgstr "Un ou plusieurs documents n'ont pas pu être supprimés."
msgid "Online Content:"
msgstr "Contenu en ligne:"
......
......@@ -187,9 +187,8 @@ It contains the same columns
</tr>
<tr>
<td>assertTextPresent</td>
<td>Deleted.</td>
<td>One or more documents could not be deleted.</td>
<td></td>
<td>We used to report error on user deleting deleted document ... but user does not care, does she?</td>
</tr>
<tr>
<td>clickAndWait</td>
......
......@@ -100,21 +100,29 @@ if object_to_remove_list:
pass
message = Base_translateString("Deleted.")
portal_status_level = "success"
# Try to call "delete_action" workflow transition on documents which defined it
# Failure of such a call is not a failure globally. The document was deleted anyway
for obj in object_to_delete_list:
# Hidden transition (without a message displayed)
# are not returned by getActionsFor
try:
portal.portal_workflow.doActionFor(obj, 'delete_action')
except ConflictError:
raise
except Exception:
pass
except WorkflowException:
# The user does not have rights to invoke delete action.
# Do not raise since delete_action may succeed for other selected documents
# Do give a warning though
message = Base_translateString("One or more documents could not be deleted.")
portal_status_level = "warning"
# make sure nothing is checked after
if selection_name:
portal.portal_selections.setSelectionCheckedUidsFor(selection_name, ())
return context.Base_redirect(form_id, keep_items={"portal_status_message": str(message)})
return context.Base_redirect(
form_id,
keep_items={
"portal_status_message": str(message),
"portal_status_level": portal_status_level,
},
)
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