From 30e50c978da30734c380906bca66248ddbf168a1 Mon Sep 17 00:00:00 2001
From: Jean-Paul Smets <jp@nexedi.com>
Date: Sat, 17 Mar 2007 10:09:14 +0000
Subject: [PATCH] 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
---
 product/ERP5/Document/BusinessTemplate.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 63c0c2dd08..ac86e1c618 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -804,6 +804,9 @@ class ObjectTemplateItem(BaseTemplateItem):
       object_id = relative_url.split('/')[-1]
       try:
         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:
           self.portal_trash.backupObject(trashbin, container_path, object_id, save=1, keep_subobjects=1)
         container.manage_delObjects([object_id])
-- 
2.30.9