Commit 2dc7d146 authored by Nicolas Delaby's avatar Nicolas Delaby

* Move recursive_path_list filling after installation because some objects

may have been deleted.
* Check that objectIds() is supported on object before calling it.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33857 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b5db55fa
...@@ -903,16 +903,6 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -903,16 +903,6 @@ class ObjectTemplateItem(BaseTemplateItem):
groups = {} groups = {}
old_groups = {} old_groups = {}
portal = context.getPortalObject() portal = context.getPortalObject()
# Fetch all sub objects path recursively
recursive_path_list = []
def fillRecursivePathList(from_path_list):
for from_path in from_path_list:
container = portal.unrestrictedTraverse(from_path, None)
if container is not None:
recursive_path_list.append(from_path)
fillRecursivePathList(['%s/%s' % (from_path, sub_content_id) for\
sub_content_id in container.objectIds()])
fillRecursivePathList(self._objects.keys())
# sort to add objects before their subobjects # sort to add objects before their subobjects
keys = self._objects.keys() keys = self._objects.keys()
keys.sort() keys.sort()
...@@ -1129,6 +1119,18 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -1129,6 +1119,18 @@ class ObjectTemplateItem(BaseTemplateItem):
# restore previous activities execution order # restore previous activities execution order
context.setPlacelessDefaultReindexParameters(**original_reindex_parameters) context.setPlacelessDefaultReindexParameters(**original_reindex_parameters)
# Do not forget to delete all remaining objects if asked by user # Do not forget to delete all remaining objects if asked by user
# Fetch all sub objects path recursively
recursive_path_list = []
def fillRecursivePathList(from_path_list):
for from_path in from_path_list:
container = portal.unrestrictedTraverse(from_path, None)
if container is not None:
recursive_path_list.append(from_path)
# Check that container support iteration of sub_content_id
if getattr(aq_base(container), 'objectIds', None) is not None:
fillRecursivePathList(['%s/%s' % (from_path, sub_content_id) for\
sub_content_id in container.objectIds()])
fillRecursivePathList(self._objects.keys())
for recursive_path in recursive_path_list: for recursive_path in recursive_path_list:
if recursive_path in update_dict: if recursive_path in update_dict:
action = update_dict[recursive_path] action = update_dict[recursive_path]
......
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