[Zope-CMF] IndexableObjectWrapper

Martin Aspeli optilude+lists at gmail.com
Wed Mar 11 08:47:01 EDT 2009


yuppie wrote:

> Why is IIndexableObjectWrapper in Plone a multi-adapter and not a simple 
> adapter for object?

Some of the indexers need access to the site root. I think the idea was 
that you could have different adapters in different types of sites by 
marking the site root, but a single adapter is probably enough.

> Could we push this further down the stack to the ZCatalog, making it 
> unnecessary to override catalog_object in CMF? AFAICS all CMF-specific 
> stuff could be done inside the wrapper.

Maybe. Touching ZCatalog is kinda scary, though.

>> 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:
>>
>> http://pypi.python.org/pypi/plone.indexer
> 
> I agree that's an important use case, but looking up 
> IIndexableObjectWrapper based on the object provides already a solution 
> for it. So we have a basic solution inside the framework and hook for 
> plugging in alternative solutions like plone.indexer.

Yep, I think that's a good idea.

Martin

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



More information about the Zope-CMF mailing list