yuppie wrote:
> Martin Aspeli wrote:
>> yuppie wrote:
>>> AFAICS wrapping the object before looking up adapters is unnecessary. 
>>> The catalog should do the lookup directly and the existing features 
>>> provided by IndexableObjectWrapper should be reimplemented as adapters.
>> Bear in mind that there is a difference between getting the wrapper 
>> itself, and getting the value to catalogue for a particular *attribute* 
>> of the wrapper (e.g. allowedRolesAndUsers).
> Why do we need the wrapper? Why can't we look up directly the adapter 
> for the particular attribute?

This could work as well. It does make it harder to change the policy en 
masse for a particular type (you'd need to override all the adapters, 
say). One reason to do that may be if you have a very simple object that 
you know exactly how to catalogue, and you don't want the overhead of 
looking up various adapters.

Still, the important use case, imho, is to make custom "indexers" for 
your custom types. I quite like the pattern in plone.indexer where we 
use an annotation to make a function into an indexer adapter:



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

Zope-CMF maillist  -  Zope-CMF@lists.zope.org

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Reply via email to