Commit 4b6979a2 authored by Aurel's avatar Aurel

don't try to backup an already removed object


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10528 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cbd6b899
...@@ -77,6 +77,10 @@ class TrashTool(BaseTool): ...@@ -77,6 +77,10 @@ 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:
# object doesn't exist any longer
pass
else:
copy = obj._p_jar.exportFile(obj._p_oid) copy = obj._p_jar.exportFile(obj._p_oid)
# import object in trash # import object in trash
connection = backup_object_container._p_jar connection = backup_object_container._p_jar
...@@ -99,7 +103,9 @@ class TrashTool(BaseTool): ...@@ -99,7 +103,9 @@ class TrashTool(BaseTool):
if obj is None: if obj is None:
object_path = container_path + [object_id] object_path = container_path + [object_id]
obj = self.unrestrictedTraverse(object_path) obj = self.unrestrictedTraverse(object_path)
if getattr(obj, 'meta_type', None) == 'ERP5 Type Information': if obj is None:
pass
elif getattr(obj, 'meta_type', None) == 'ERP5 Type Information':
subobjects_dict = {} subobjects_dict = {}
subobjects_dict['allowed_content_type_list'] = getattr(obj, 'allowed_content_types', []) or [] subobjects_dict['allowed_content_type_list'] = getattr(obj, 'allowed_content_types', []) or []
subobjects_dict['hidden_content_type_list'] = getattr(obj, 'hidden_content_type_list', []) or [] subobjects_dict['hidden_content_type_list'] = getattr(obj, 'hidden_content_type_list', []) or []
...@@ -127,6 +133,9 @@ class TrashTool(BaseTool): ...@@ -127,6 +133,9 @@ class TrashTool(BaseTool):
else: else:
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:
pass
else:
for subobject_id in list(obj.objectIds()): for subobject_id in list(obj.objectIds()):
subobject_path = object_path + [subobject_id] subobject_path = object_path + [subobject_id]
subobject = self.unrestrictedTraverse(subobject_path) subobject = self.unrestrictedTraverse(subobject_path)
...@@ -134,7 +143,6 @@ class TrashTool(BaseTool): ...@@ -134,7 +143,6 @@ class TrashTool(BaseTool):
subobjects_dict[subobject_id] = subobject_copy subobjects_dict[subobject_id] = subobject_copy
if save: # remove subobjecs from backup object if save: # remove subobjecs from backup object
obj.manage_delObjects([subobject_id]) obj.manage_delObjects([subobject_id])
# LOG('return subobject dict', 0, subobjects_dict)
return subobjects_dict return subobjects_dict
def newTrashBin(self, bt_title='trash', bt=None): def newTrashBin(self, bt_title='trash', bt=None):
......
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