Commit 3217fdaa authored by Arnaud Fontaine's avatar Arnaud Fontaine

BusinessTemplate: Get rid of spurious warning when skipping update of Local...

BusinessTemplate: Get rid of spurious warning when skipping update of Local Roles for non-ERP5 objects.
parent 0836d567
...@@ -1473,16 +1473,12 @@ class PathTemplateItem(ObjectTemplateItem): ...@@ -1473,16 +1473,12 @@ class PathTemplateItem(ObjectTemplateItem):
update_dict = defaultdict(list) update_dict = defaultdict(list)
for path in self._objects: for path in self._objects:
obj = p.unrestrictedTraverse(path, None) obj = p.unrestrictedTraverse(path, None)
# Ignore any object without PortalType (non-ERP5 objects)
try: try:
portal_type = aq_base(obj).getPortalType() portal_type = aq_base(obj).getPortalType()
except Exception, e: except Exception, e:
LOG("BusinessTemplate", WARNING, pass
"Could not update Local Roles as Portal Type for '%s' (obj: %s)" else:
" is not available" % (path, obj), error=True)
continue
if portal_type not in p.portal_types: if portal_type not in p.portal_types:
LOG("BusinessTemplate", WARNING, LOG("BusinessTemplate", WARNING,
"Could not update Local Roles as Portal Type '%s' could not " "Could not update Local Roles as Portal Type '%s' could not "
...@@ -1496,6 +1492,7 @@ class PathTemplateItem(ObjectTemplateItem): ...@@ -1496,6 +1492,7 @@ class PathTemplateItem(ObjectTemplateItem):
if portal_type_role_list_len_dict[portal_type]: if portal_type_role_list_len_dict[portal_type]:
update_dict[portal_type].append(obj) update_dict[portal_type].append(obj)
if update_dict: if update_dict:
def updateLocalRolesOnDocument(): def updateLocalRolesOnDocument():
for portal_type, obj_list in update_dict.iteritems(): for portal_type, obj_list in update_dict.iteritems():
......
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