Commit 34af6ac0 authored by Aurel's avatar Aurel

change some names to not use python-reserved name


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4681 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2d54c033
...@@ -74,16 +74,17 @@ class TrashTool(BaseTool): ...@@ -74,16 +74,17 @@ class TrashTool(BaseTool):
if object_id not in backup_object_container.objectIds(): if object_id not in backup_object_container.objectIds():
# export object # export object
object_path = container_path + [object_id] object_path = container_path + [object_id]
object = self.unrestrictedTraverse(object_path) obj = self.unrestrictedTraverse(object_path)
copy = object._p_jar.exportFile(object._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
obj = backup_object_container o = backup_object_container
while connection is None: while connection is None:
obj = obj.aq_parent o = o.aq_parent
connection=obj._p_jar connection=o._p_jar
copy.seek(0) copy.seek(0)
backup = connection.importFile(copy) backup = connection.importFile(copy)
backup.isIndexabla = 0
backup_object_container._setObject(object_id, backup) backup_object_container._setObject(object_id, backup)
keep_sub = kw.get('keep_subobjects', 0) keep_sub = kw.get('keep_subobjects', 0)
...@@ -91,17 +92,17 @@ class TrashTool(BaseTool): ...@@ -91,17 +92,17 @@ class TrashTool(BaseTool):
if not keep_sub: if not keep_sub:
# export subobjects # export subobjects
if save: if save:
object = backup_object_container._getOb(object_id) obj = backup_object_container._getOb(object_id)
else: else:
object_path = container_path + [object_id] object_path = container_path + [object_id]
object = self.unrestrictedTraverse(object_path) obj = self.unrestrictedTraverse(object_path)
for subobject_id in list(object.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)
subobject_copy = subobject._p_jar.exportFile(subobject._p_oid) subobject_copy = subobject._p_jar.exportFile(subobject._p_oid)
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
object.manage_delObjects([subobject_id]) obj.manage_delObjects([subobject_id])
# LOG('return subobject dict', 0, subobjects_dict) # LOG('return subobject dict', 0, subobjects_dict)
return subobjects_dict return subobjects_dict
...@@ -131,18 +132,18 @@ class TrashTool(BaseTool): ...@@ -131,18 +132,18 @@ class TrashTool(BaseTool):
""" """
Return a list of trash objects for a given trash bin Return a list of trash objects for a given trash bin
""" """
def getChildObjects(object): def getChildObjects(obj):
object_list = [] object_list = []
if hasattr(aq_base(object), 'objectValues'): if hasattr(aq_base(obj), 'objectValues'):
childObjects = object.objectValues() childObjects = obj.objectValues()
if hasattr(aq_base(object), 'isHidden'): if hasattr(aq_base(obj), 'isHidden'):
if not object.isHidden: if not obj.isHidden:
object_list.append(object) object_list.append(obj)
if len(childObjects) > 0: if len(childObjects) > 0:
for object in childObjects: for o in childObjects:
object_list.extend(getChildObjects(object)) object_list.extend(getChildObjects(o))
else: else:
object_list.append(object) object_list.append(obj)
return object_list return object_list
list = getChildObjects(trashbin) list = getChildObjects(trashbin)
......
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