Commit fd93f03e authored by Arnaud Fontaine's avatar Arnaud Fontaine

Do not try to backup uncommitted objects in TrashTool because it later

raises an AttributeError exception as the object couldn't be imported
properly afterwards



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40152 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ee454ff4
...@@ -83,15 +83,16 @@ class TrashTool(BaseTool): ...@@ -83,15 +83,16 @@ class TrashTool(BaseTool):
# export object # export object
object_path = container_path + [object_id] object_path = container_path + [object_id]
obj = self.unrestrictedTraverse(object_path) obj = self.unrestrictedTraverse(object_path)
if obj is None: if obj is not None:
# object doesn't exist any longer
pass
else:
connection = obj._p_jar connection = obj._p_jar
o = obj o = obj
while connection is None: while connection is None:
o = o.aq_parent o = o.aq_parent
connection=o._p_jar connection=o._p_jar
if obj._p_oid is None:
LOG("Trash Tool backupObject", 100,
"Trying to backup uncommitted object %s" % object_path)
return {}
copy = connection.exportFile(obj._p_oid) copy = connection.exportFile(obj._p_oid)
# import object in trash # import object in trash
connection = backup_object_container._p_jar connection = backup_object_container._p_jar
...@@ -121,7 +122,7 @@ class TrashTool(BaseTool): ...@@ -121,7 +122,7 @@ class TrashTool(BaseTool):
# Folder and not a Form, or a module for the old object is # Folder and not a Form, or a module for the old object is
# already removed, and we cannot backup the object # already removed, and we cannot backup the object
LOG("Trash Tool backupObject", 100, "Can't backup object %s" %(object_id)) LOG("Trash Tool backupObject", 100, "Can't backup object %s" %(object_id))
pass return {}
keep_sub = kw.get('keep_subobjects', 0) keep_sub = kw.get('keep_subobjects', 0)
subobjects_dict = {} subobjects_dict = {}
......
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