[Zope3-Users] Adapting multiple times
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? Regards, Frank ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Adapting multiple times
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 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Adapting multiple times
Hi, On Wed, Apr 05, 2006 at 08:59:19AM +0200, Michael Howitz wrote: 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. Thank you for the quick response. Problem ist: there is not just ISearchableEN but one interface like that per supported language (~ 10 languages supported). I expect to write at least 20 content object types. It just doesn't scale. Doing the adaption chain manually in a modified TextIndex is the only alternative, if Zope is not able to do it automatically. Thank you, Frank ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Adapting multiple times
Frank Burkhardt wrote: [snip] 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. Thank you for the quick response. Problem ist: there is not just ISearchableEN but one interface like that per supported language (~ 10 languages supported). I expect to write at least 20 content object types. It just doesn't scale. Doing the adaption chain manually in a modified TextIndex is the only alternative, if Zope is not able to do it automatically. Maybe there's a way to leverage named adapters? I.e. look for the adapter not just by interface but also by name, and use a different name for each language. Regards, Martijn ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users