[Zope-dev] Xron and Zope 2.4.0 again

Loren Stafford lstafford@morphics.com
Thu, 26 Jul 2001 13:39:41 -0700


Thanks Steve and Chris,

If someone wants to try this out, the patches should go in the Schedule.py
module of Xron. There are two calls to addIndex() in the __init__ method.

I don't have 2.4.0 running yet and probably won't for awhile; so, good luck.

I'm also including Chris' follow-up at the end so everything is in one
message.

-- Loren


> -----Original Message-----
> From: zope-dev-admin@zope.org [mailto:zope-dev-admin@zope.org]On Behalf
> Of Steve Alexander
> Sent: Thursday, July 26, 2001 12:44
> To: Loren Stafford
> Cc: Remi Delon; zope-dev@zope.org
> Subject: Re: [Zope-dev] Xron and Zope 2.4.0 again
>
> Before you might have done this:
>
> self._catalog.addIndex('name', 'FieldIndex')
>
> You now need to do this:
>
> self._catalog.addIndex('name', UnIndex('name'))
>
> The same goes for KeywordIndex (UnKeywordIndex) and TextIndex
> (UnTextIndex).
>
> You'll also need
>
> from SearchIndex.UnIndex import UnIndex
> from SearchIndex.UnTextIndex import UnTextIndex
> from SearchIndex.UnKeywordIndex import UnKeywordIndex
>
> in there somewhere.
>
> I patched tracked to adapt to either the old or new styles:
>
>      field_indexes=('type', 'numid', 'exemptions', 'date', 'stage',
>                     'priority', 'requester', 'from', 'private')
>      keyword_indexes=('issueOwners','subscribers','traitVals')
>      text_indexes=('text_content',)
>      addIndex=self._catalog.addIndex
>      # try to add indexes in Zope 2.3 style. If this fails
>      # then add them in Zope 2.4 style
>      try:
>          for name in field_indexes:
>              addIndex(name, 'FieldIndex')
>          for name in keyword_indexes:
>              addIndex(name, 'KeywordIndex')
>          for name in text_indexes:
>              addIndex(name, 'TextIndex')
>      except TypeError:
>          from SearchIndex.UnIndex import UnIndex
>          from SearchIndex.UnTextIndex import UnTextIndex
>          from SearchIndex.UnKeywordIndex import UnKeywordIndex
>
>          for name in field_indexes:
>              addIndex(name, UnIndex(name))
>          for name in keyword_indexes:
>              addIndex(name, UnKeywordIndex(name))
>          for name in text_indexes:
>              addIndex(name, UnTextIndex(name))
>
> --
> Steve Alexander
> Software Engineer
> Cat-Box limited
>

=========================================================================

> -----Original Message-----
> From: zope-dev-admin@zope.org [mailto:zope-dev-admin@zope.org]On Behalf
> Of Chris Withers
> Sent: Thursday, July 26, 2001 12:53
> To: Steve Alexander
> Cc: Loren Stafford; Remi Delon; zope-dev@zope.org
> Subject: Re: [Zope-dev] Xron and Zope 2.4.0 again
>
>
> Steve Alexander wrote:
> >
> > from SearchIndex.UnIndex import UnIndex
> > from SearchIndex.UnTextIndex import UnTextIndex
> > from SearchIndex.UnKeywordIndex import UnKeywordIndex
>
> I'm not sure this is a good idea.
>
> I think you're supposed to do something like:
>
> from Products.PluginIndexes.FieldIndex.FieldIndex import FieldIndex
>
> ...and use that in addIndex.
>
> cheers,
>
> Chris
>