Commit feded98f authored by Jérome Perrin's avatar Jérome Perrin

BusinessTemplate: do not fail when regenerating roles of a path that no longer exist

parent 09960648
...@@ -1489,18 +1489,19 @@ class PathTemplateItem(ObjectTemplateItem): ...@@ -1489,18 +1489,19 @@ class PathTemplateItem(ObjectTemplateItem):
def install(self, context, *args, **kw): def install(self, context, *args, **kw):
super(PathTemplateItem, self).install(context, *args, **kw) super(PathTemplateItem, self).install(context, *args, **kw)
# Regenerate local roles for all paths in this business template
p = context.getPortalObject() p = context.getPortalObject()
portal_type_role_list_len_dict = {} portal_type_role_list_len_dict = {}
update_dict = defaultdict(list) update_dict = defaultdict(list)
for path in self._objects: for path in self._objects:
obj = p.unrestrictedTraverse(path) obj = p.unrestrictedTraverse(path, None)
try: try:
portal_type = aq_base(obj).getPortalType() portal_type = aq_base(obj).getPortalType()
except Exception, e: except Exception, e:
LOG("BusinessTemplate", WARNING, LOG("BusinessTemplate", WARNING,
"Could not update Local Roles as Portal Type for '%s' is not " "Could not update Local Roles as Portal Type for '%s' (obj: %s)"
"available (%s)" % (obj, e)) " is not available" % (path, obj), error=True)
continue continue
......
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