Commit 30e50c97 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added instruction to force a more predictable exception to be thrown in case of failure.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13468 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c2ec3c22
...@@ -804,6 +804,9 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -804,6 +804,9 @@ class ObjectTemplateItem(BaseTemplateItem):
object_id = relative_url.split('/')[-1] object_id = relative_url.split('/')[-1]
try: try:
container = portal.unrestrictedTraverse(container_path) container = portal.unrestrictedTraverse(container_path)
object = container[object_id] # We force access to the object to be sure
# that appropriate exception is thrown
# in case object is already backup and/or removed
if trash and trashbin is not None: if trash and trashbin is not None:
self.portal_trash.backupObject(trashbin, container_path, object_id, save=1, keep_subobjects=1) self.portal_trash.backupObject(trashbin, container_path, object_id, save=1, keep_subobjects=1)
container.manage_delObjects([object_id]) container.manage_delObjects([object_id])
......
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