Hi Andreas!

Andreas Jung wrote:
we have a CMF-based application where I am trying to migrate from TextIndexNG 2 -> 3.

For a content-type class A I have configured an adapter to implement
IIndexableContent. However when the object is reindexed CMF wraps
the object as IndexableObjectWrapper which by itself implements
the IndexableObjectWrapper interface. The low-level indexer of TXNG
get the wrapped object and has no idea what to do with the object since the interface of the wrapper shadows the interface of the wrapped object.
Any idea how to deal with this problem?

I'm currently fighting with the same issue. And I was in the process of writing a mail to the Zope-CMF list when your mail came in. AFAICS this is more a CMF issue than a Five issue, so I add Zope-CMF to the recipients list.

Just for the records, I'm sure you already figured that out yourself:

Plone 2.1 doesn't have this issue because it has no interface declaration on its ExtensibleIndexableObjectWrapper. If the wrapper doesn't have its own __providedBy__ attribute the __getattr__ method looks it up in the wrapped class, making the interface declarations completely transparent.

Plone 2.5 has an interface declaration so I guess it has the same problem as the CMF.

The quick and dirty solution would be to remove the interface declaration from the wrapper. The clean solution would be to make sure that all the interfaces that are actually provided - the wrapper interface *and* the interfaces of the wrapped object - can be looked up. But implementing that seems to require deeper knowledge of the interface machinery than I have.

So if nobody can come up with a patch for the clean solution I propose just to remove the interface declaration in CMF.

An alternative approach would be to modify TextIndexNG and try to unwrap the object if no adapter can be found. But that would mean that TextIndexNG would depend on the knowledge of CMF specific implementation details.



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

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to