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):
if action == 'nothing':
continue
path = 'portal_types/%s' % roles_path.split('/', 1)[1]
obj = p.unrestrictedTraverse(path)
setattr(obj, '_roles', []) # reset roles before applying
type_roles_list = self._objects[roles_path] or []
for type_role_property_dict in type_roles_list:
obj._roles.append(RoleInformation(**type_role_property_dict))
obj = p.unrestrictedTraverse(path, None)
if obj is not None:
setattr(obj, '_roles', []) # reset roles before applying
type_roles_list = self._objects[roles_path] or []
for type_role_property_dict in type_roles_list:
obj._roles.append(RoleInformation(**type_role_property_dict))
def uninstall(self, context, **kw):
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