[Zope3-dev] Principal Folder How-To

Dominik Huber dominik.huber at projekt01.ch
Mon Feb 21 04:16:02 EST 2005


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.
   """

IMO the advantage of such a pattern would be, that we could establish 
the simple rule "an utitlity provides only one interface" and we force 
people to use the adaption mechanism to aquire dependent functionality.
(IMO multi-implementation is intrinsically already an implementation 
detail. If we want decouple components 
<se?lp=ende&p=/Mn4k.&search=decouple> people should use 
aSlaveFunctionality = IASlave(aMasterUtitlity).)

>We simply do not know which interface is providing a utility. So we offer all 
>utilities that a particular component provides. The solution to this problem 
>would be to create an interface type called IUtilityType and make all utility 
>interfaces provide this interface. This is basically the same we did for 
>content types.
>
Utilites provide often funtionality related interfaces. IMO it's not the 
correct way to type those interfaces by IUtilityType because those 
interfaces could be used for regular adaption of none-utility components 
too.

An other problem is the named and unnamed stuff:
The PAU works only if it is unamd (respectively '' named). In cases 
where named utitlites are ignored we should be able not to offer the 
*register as* field.

Regards,
Dominik Huber





More information about the Zope3-dev mailing list