[Zope-CMF] error in CMFCore/MembershipTool

robert robert@redcor.ch
Wed, 9 Apr 2003 17:47:58 +0200


the function getCandidateLocalRoles tries to delete the  'Member'-role.
This dies when a user does not have such a role.
It should therefore be wrapped in a try statement as follows.

  security.declareProtected(View, 'getCandidateLocalRoles')
    def getCandidateLocalRoles( self, obj ):
        """ What local roles can I assign? """
        member =3D self.getAuthenticatedMember()

        if 'Manager' in member.getRoles():
            return self.getPortalRoles()
        else:
            member_roles =3D list( member.getRolesInContext( obj ) )
            try: <---------------------------------- added try statement
                del member_roles[member_roles.index( 'Member')]
            except:
                pass

        return tuple( member_roles )

I filed an collector issue=20
=2D-=20
mit freundlichen Gr=FCssen

Robert Rottermann
www.redCOR.ch