Commit dd14d194 authored by Aurel's avatar Aurel

add a way to include object recursively in path by specifying **


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4593 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1ae2c8db
...@@ -612,6 +612,9 @@ class PathTemplateItem(ObjectTemplateItem): ...@@ -612,6 +612,9 @@ class PathTemplateItem(ObjectTemplateItem):
BaseTemplateItem.build(self, context, **kw) BaseTemplateItem.build(self, context, **kw)
p = context.getPortalObject() p = context.getPortalObject()
for path in self._path_archive.keys(): for path in self._path_archive.keys():
include_subobjects = 0
if '**' in path:
include_subobjects = 1
for relative_url in self._resolvePath(p, [], path.split('/')): for relative_url in self._resolvePath(p, [], path.split('/')):
object = p.unrestrictedTraverse(relative_url) object = p.unrestrictedTraverse(relative_url)
object = object._getCopy(context) object = object._getCopy(context)
...@@ -627,6 +630,8 @@ class PathTemplateItem(ObjectTemplateItem): ...@@ -627,6 +630,8 @@ class PathTemplateItem(ObjectTemplateItem):
# we must keep groups because it's ereased when we delete subobjects # we must keep groups because it's ereased when we delete subobjects
groups = deepcopy(object.groups) groups = deepcopy(object.groups)
if len(id_list) > 0: if len(id_list) > 0:
if include_subobjects:
self.build_sub_objects(context, id_list, relative_url)
object.manage_delObjects(list(id_list)) object.manage_delObjects(list(id_list))
if hasattr(object, 'groups'): if hasattr(object, 'groups'):
object.groups = groups object.groups = groups
......
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