[Zope3-Users] Adapting multiple times

Michael Howitz mh at gocept.com
Wed Apr 5 02:59:19 EDT 2006


Am Mittwoch, den 05.04.2006, 08:48 +0200 schrieb Frank Burkhardt:
> Hi,
> 
> I've got objects implementing interface
> 
>  IMyObject
>  
> and two adapters:
> 
>  IMyObject -> ISearchable
>  ISearchable -> ISearchableEN
> 
> I would like to use a TextIndex to do fulltext search on objects
> implementing ISearchableEN .
> Unfortunately this doesn't work. The TextIndex tries something
> like this to adapt an object to the given interface:
> 
>  ISearchableEN(myobject)
> 
> Which fails ("Unable to adapt") because there is no adapter
> "IMyObject -> ISearchableEN" and Zope doesn't try to adapt multiple
> times ( IMyObject -> ISearchable -> ISearchableEN ).
> 
> Does anyone have an Idea how to do this or do I have to modify
> the TextIndex?

Idea: Write an adater which Adapts IMyObject to ISearchableEN. This
Adapter can be a function which only does the adaption chain and returns
the Adapter to ISearchableEn adapter.

HTH,
 mac



More information about the Zope3-users mailing list