[Zope3-dev] Sprintathon: searching?

Steve Alexander steve@cat-box.net
Wed, 06 Nov 2002 17:10:37 +0000


> I'll go farther than that. It's absolutely forbidden for any standard
>  Zope 3 frameworks to require ordinary (as opposed to meta) content
> objects to implement specific interfaces.  Content objects shall
> never be required to be modified to work with Zope 3 frameworks.
> Consider this a Papal edict. :)

Note that if you have a particular case where you do really really want 
to avoid the bother of writing a new component, you can still go the 
Zope 2 way and implement a method on your content class.

   class MyContent:
       __implements__ = IWhatever, IFooBar, ISearchableText

      .... later ...

      def getSearchableText(self):
          return '%s %s %s' % (self.foo, self.bar, self.baz)

In this case, when an index requests an ISearchableText adapter for one 
of your MyContent objects, the object itself will be returned to give 
its own searchable text.

So, the framework enables splitting stuff up into components, but 
doesn't require it.

--
Steve Alexander