[Zope3-dev] Principal Folder How-To

Jim Fulton jim at zope.com
Mon Feb 21 07:54:33 EST 2005


Dominik Huber wrote:
> Stephan Richter wrote:
> 
>> On Sunday 20 February 2005 16:57, Garrett Smith wrote:
>>  
>>
>>>>> Make sure you register the PAU as providing IAuthentication (it's a
>>>>> number of interfaces down in the list, so not obvious that you must
>>>>> choose it).
>>>>>       
>>>>
>>>> Can you tell me why we offer more the one (the right) inteface?
>>>> Is there a use case for to register a utility providing another
>>>> interface then the interface which was the utility developed for?
>>>>     
>>>
>>> You can register a utility as providing more than one interface. This is
>>> more theory than practice though.
>>>   
>>
>>
>> That is not quiet true. Several of the new PAU plugins provide two 
>> interfaces at a time.
>>
> We could provide only the main interface (master) by implementation and 
> the others by adaption...
> 
> class IAMaster(Interface):
>    """...
>       Utilities providing this interface must offer IASlave by adaption.
>   """

This doesn't work.  While it is true that pairs of interfaces are often
provided by the same object, this is not always the case.  So, for example,
principal folders provide IAuthenticationPlugin and IPrincipalSearchPlugin,
group folders provide only IPrincipalSearchPlugin.  In theory, a plugin
that privided IAuthenticationPlugin and IPrincipalSearchPlugin, might also
provide IPrincipalFactoryPlugin.  This is the case, I believe for the Zope 2
LDAP plugin.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list