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,29 +1473,26 @@ class PathTemplateItem(ObjectTemplateItem): ...@@ -1473,29 +1473,26 @@ 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) if portal_type not in p.portal_types:
LOG("BusinessTemplate", WARNING,
continue "Could not update Local Roles as Portal Type '%s' could not "
"be found" % portal_type)
if portal_type not in p.portal_types: continue
LOG("BusinessTemplate", WARNING,
"Could not update Local Roles as Portal Type '%s' could not "
"be found" % portal_type)
continue if portal_type not in portal_type_role_list_len_dict:
portal_type_role_list_len_dict[portal_type] = \
len(p.portal_types[portal_type].getRoleInformationList())
if portal_type not in portal_type_role_list_len_dict: if portal_type_role_list_len_dict[portal_type]:
portal_type_role_list_len_dict[portal_type] = \ update_dict[portal_type].append(obj)
len(p.portal_types[portal_type].getRoleInformationList())
if portal_type_role_list_len_dict[portal_type]:
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