[Zope-CMF] IIndexableObjectWrapper

Martin Aspeli optilude+lists at gmail.com
Sun Apr 5 08:46:37 EDT 2009


Jens Vagelpohl wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> On Apr 5, 2009, at 12:14 , Martin Aspeli wrote:
> 
>> Hi,
>>
>> Plone 3.3's IIndexableObjectWrapper implementation (in plone.indexer)
>> has a method _getWrappedObject(), to return the object that was  
>> wrapped
>> by the indexable object wrapper. It is (or rather, will be) used by
>> TextIndexNG3, which needs to access the raw object during indexing.
>>
>> Any objections to pushing this down into CMFCore's definition of that
>> interface?
> 
> A method name starting with an underscore is presumably a "private"  
> method with restricted use by the internal implementation. I would at  
> least rename it to something without underscore before putting it into  
> the interface.

In general, I agree, but there's a problem: any method on the wrapper 
could collide with an index or metadata item and thus get indexed in the 
catalog. Thus, the method is "private" in the sense that it's not to be 
considered part of the "wrapped" object.

It may not seem very likely that someone has an index called 
getWrappedObject, but there's (stupid) support in Archetypes to create 
indexes from fields based on the accessors of those fields, so an 
auto-created index for an AT field wrappedObject would default to being 
called getWrappedObject(). Again, not hugely likely, but I think it 
makes sense to say that all methods on the wrapper that are *not* 
"indexable" are "private" in this sense.

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