From acfcc2885934b57da9cf13e0967da94c83192cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com> Date: Thu, 6 Apr 2006 15:25:30 +0000 Subject: [PATCH] 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 --- product/ERP5/Document/BusinessTemplate.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index 9248531833..840810f3ff 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -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() -- 2.30.9