[Checkins] SVN: Products.PluggableAuthService/trunk/Products/PluggableAuthService/ - plugins/ZODBRoleManager: added logging in case searchPrincipial()

Sidnei da Silva sidnei at enfoldsystems.com
Thu Mar 6 08:50:37 EST 2008


Wait! That doesn't look right. You are not checking if it really
returned more than one result before logging, so it will *always* log
a message saying that it returned more than one result, even when it
didn't!

On Thu, Mar 6, 2008 at 6:09 AM, Andreas Jung <andreas at andreas-jung.com> wrote:
> Log message for revision 84503:
>        - plugins/ZODBRoleManager: added logging in case searchPrincipial()
>          returning more than one result (which might happen in case of
>          having duplicate id within difference user sources)
>
>
>
> Changed:
>  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/doc/CHANGES.txt
>  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBRoleManager.py
>
> -=-
> Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/doc/CHANGES.txt
> ===================================================================
> --- Products.PluggableAuthService/trunk/Products/PluggableAuthService/doc/CHANGES.txt   2008-03-06 08:03:32 UTC (rev 84502)
> +++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/doc/CHANGES.txt   2008-03-06 09:09:27 UTC (rev 84503)
> @@ -8,6 +8,12 @@
>         for 'startswith' test and (if the IPy module is present) IP-range
>         tests.  See https://bugs.launchpad.net/zope-pas/+bug/173580 .
>
> +    Bugs fixed
> +
> +      - plugins/ZODBRoleManager: added logging in case searchPrincipial()
> +        returning more than one result (which might happen in case of
> +        having duplicate id within difference user sources)
> +
>   PluggableAuthService 1.5.2 (2007/11/28)
>
>     Bugs fixed
>
> Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBRoleManager.py
> ===================================================================
> --- Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBRoleManager.py        2008-03-06 08:03:32 UTC (rev 84502)
> +++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBRoleManager.py        2008-03-06 09:09:27 UTC (rev 84503)
> @@ -37,6 +37,10 @@
>  from Products.PluggableAuthService.utils import classImplements
>  from Products.PluggableAuthService.utils import postonly
>
> +import logging
> +
> +LOG = logging.getLogger('PluggableAuthService')
> +
>  class IZODBRoleManager(Interface):
>     """ Marker interface.
>     """
> @@ -271,7 +275,10 @@
>
>                 parent = aq_parent( self )
>                 info = parent.searchPrincipals( id=k, exact_match=True )
> -                assert( len( info ) in ( 0, 1 ) )
> +
> +                LOG.error('searchPrincipals() returned more than one result '
> +                          'id=%s' % k)
> +                assert len(info) <= 1
>                 if len( info ) == 0:
>                     title = '<%s: not found>' % k
>                 else:
>
> _______________________________________________
> Checkins mailing list
> Checkins at zope.org
> http://mail.zope.org/mailman/listinfo/checkins
>



-- 
Sidnei da Silva
Enfold Systems                http://enfoldsystems.com
Fax +1 832 201 8856     Office +1 713 942 2377 Ext 214


More information about the Checkins mailing list