[Zope-dev] improving the utility and adapter lookup APIs

Gary Poster gary.poster at gmail.com
Wed Nov 25 11:20:52 EST 2009


On Nov 25, 2009, at 11:17 AM, Thomas Lotze wrote:

> Martijn Faassen wrote:
> 
>> Adapter:
>> 
>> IFoo(x)
> 
> [...]
> 
>> Multiadapter:
>> 
>> IFoo.multi(x, y)
> 
> [...]
> 
>> Utility:
>> 
>> IFoo.utility()
>> 
>> [or possibly IFoo() instead?]
> 
> What about a simple and consistent API for all components including
> utilities, adapters and multiadapters:
> 
> IFoo()
> IFoo(x)
> IFoo(x, y)
> 
> I seem to remember there had been some discussion at some point about
> dropping or at least loosening the distinction between utilities and
> adapters anyway, so this would be the opportunity to do so at the API
> level.

That was discussed and rejected near the very beginning of the Z3 effort, in my memory.  They are too different.  Our use of adapters generally involves looking something up and automatically calling it.  Our use of utilities generally involves simply looking something up and returning it.

Gary


More information about the Zope-Dev mailing list