Re: improving the utility and adapter lookup APIs

Martin Aspeli <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
Tim Hoffman wrote:
> Just re-inforcing this I almost never do IFoo. adaption as I am almost
> always using
> multiadapters and utilities so I completely forget about the IFoo
> adaption capability.
> Which means I always just write getAdapter as well as it seems more
> consistent to
> from an api consumption point of view.

I use the IFoo(x) to invoke an adapter (and IFoo(x, None) lookup for a 
fallback) a *lot*. As in, virtually in every piece of (Zope) software I 
write.

I've also encouraged people to do that in at least three major pieces of 
documentation (including my book).

Similarly, answering a different part of this thread: I use custom 
adapter factories from time to time, and have documented them as useful 
practice. Normally, that's because I want to look up the adapter 
implementation from someplace else than the global registry (e.g. 
plone.portlets fishes a persistent object out of an annotation at one 
point), or because I want the ability to "abort" the annotation by 
returning None (plone.behavior does that - actually, plone.behavior is a 
good example of the former also).

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.