Commit 797981e3 authored by Aurel's avatar Aurel

prevent some failure when backuping, thanks to bartek

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15699 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 48506fc6
...@@ -82,7 +82,12 @@ class TrashTool(BaseTool): ...@@ -82,7 +82,12 @@ class TrashTool(BaseTool):
# object doesn't exist any longer # object doesn't exist any longer
pass pass
else: else:
copy = obj._p_jar.exportFile(obj._p_oid) connection = obj._p_jar
o = obj
while connection is None:
o = o.aq_parent
connection=o._p_jar
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
o = backup_object_container o = backup_object_container
...@@ -91,8 +96,8 @@ class TrashTool(BaseTool): ...@@ -91,8 +96,8 @@ class TrashTool(BaseTool):
connection=o._p_jar connection=o._p_jar
copy.seek(0) copy.seek(0)
backup = connection.importFile(copy) backup = connection.importFile(copy)
backup.isIndexable = 0
try: try:
backup.isIndexable = 0
backup_object_container._setObject(object_id, backup) backup_object_container._setObject(object_id, backup)
except AttributeError: except AttributeError:
# XXX we can go here due to formulator because attribute field_added # XXX we can go here due to formulator because attribute field_added
...@@ -103,7 +108,7 @@ class TrashTool(BaseTool): ...@@ -103,7 +108,7 @@ class TrashTool(BaseTool):
# in case of portal types, export properties instead of subobjects # in case of portal types, export properties instead of subobjects
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, None)
if obj is None: if obj is None:
pass pass
elif getattr(obj, 'meta_type', None) == 'ERP5 Type Information': elif getattr(obj, 'meta_type', None) == 'ERP5 Type Information':
......
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