Commit acfcc288 authored by Aurel's avatar Aurel

don't fail if portal type not found when installing roles


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6487 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 361815ce
...@@ -1897,11 +1897,12 @@ class PortalTypeRolesTemplateItem(BaseTemplateItem): ...@@ -1897,11 +1897,12 @@ class PortalTypeRolesTemplateItem(BaseTemplateItem):
if action == 'nothing': if action == 'nothing':
continue continue
path = 'portal_types/%s' % roles_path.split('/', 1)[1] path = 'portal_types/%s' % roles_path.split('/', 1)[1]
obj = p.unrestrictedTraverse(path) obj = p.unrestrictedTraverse(path, None)
setattr(obj, '_roles', []) # reset roles before applying if obj is not None:
type_roles_list = self._objects[roles_path] or [] setattr(obj, '_roles', []) # reset roles before applying
for type_role_property_dict in type_roles_list: type_roles_list = self._objects[roles_path] or []
obj._roles.append(RoleInformation(**type_role_property_dict)) for type_role_property_dict in type_roles_list:
obj._roles.append(RoleInformation(**type_role_property_dict))
def uninstall(self, context, **kw): def uninstall(self, context, **kw):
p = context.getPortalObject() p = context.getPortalObject()
......
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