-----BEGIN PGP SIGNED MESSAGE-----
Sidnei da Silva wrote:
> There is an assertion in ZODBRoleManager, in the
> listAssignedPrincipals method that makes it bomb when there's more
> than one principal returned from searchPrincipals.
> Now, while it doesn't make much sense to have principals with the same
> id being returned by different plugins, that might be just the wrong
> place to enforce this.
We aren't "enforcing" anything: the plugin can't fulfill its own
contract (in this case, to return a list of (id, title) tuples) if the
user has screwed up by configuring the other plugins that way.
> Is anyone against removing that assertion?
- -1. Asserts only affect debug mode, anyway, which means that they help
> Reproducing the method below for the lazy:
> def listAssignedPrincipals( self, role_id ):
> """ Return a list of principal IDs to whom a role is assigned.
> result = 
> for k, v in self._principal_roles.items():
> if role_id in v:
> # should be at most one and only one mapping to 'k'
> parent = aq_parent( self )
> info = parent.searchPrincipals( id=k, exact_match=True
> assert( len( info ) in ( 0, 1 ) )
> if len( info ) == 0:
> title = '<%s: not found>' % k
> title = info.get( 'title', k )
> result.append( ( k, title ) )
> return result
Tres Seaver +1 202-558-7113 [EMAIL PROTECTED]
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Zope-PAS mailing list