From 7fc3ff265e36275739acb7533927c3f788db2992 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Thu, 29 Dec 2005 17:18:21 +0000
Subject: [PATCH] catch exception raise from Formulator because container of
 backup object is not a form

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4949 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Tool/TrashTool.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/Tool/TrashTool.py b/product/ERP5/Tool/TrashTool.py
index 5735b33236..49a9b193b4 100755
--- a/product/ERP5/Tool/TrashTool.py
+++ b/product/ERP5/Tool/TrashTool.py
@@ -85,7 +85,14 @@ class TrashTool(BaseTool):
         copy.seek(0)
         backup = connection.importFile(copy)
         backup.isIndexable = 0
-        backup_object_container._setObject(object_id, backup)
+        try:
+          backup_object_container._setObject(object_id, backup)
+        except AttributeError:
+          # XXX we can go here due to formulator because attribute field_added
+          # doesn't not exists on parent if it is a Trash Folder and not a Form
+          # so object is not backup
+          LOG("Trash Tool backupObject", 100, "Can't backup object %s" %(object_id))
+          pass
         
     keep_sub = kw.get('keep_subobjects', 0)
     subobjects_dict = {}
-- 
2.30.9