[Zope-dev] ZCatalog bug

Steve Alexander steve@cat-box.net
Tue, 18 Sep 2001 21:53:45 +0100


I'm updating a site that is currently using Python 1.5.2 and Zope 
2.3.something to use Python 2.1 and Zope 2.4.from_cvs.

I've had a problem: most products won't initialize. They fail on an 
AttributeError in SearchIndex/UnTextIndex.py related to setting up the 
help system.

This ugly patch fixes it. There must be a better way!



*** /lib/python/SearchIndex/UnTextIndex.py.original
--- /lib/python/SearchIndex/UnTextIndex.py.new
***************
*** 327,333 ****
               return 0

           lexicon = self.getLexicon(self._lexicon)
!         splitter=lexicon.Splitter

           wordScores = OIBTree()
           last = None
--- 327,337 ----
               return 0

           lexicon = self.getLexicon(self._lexicon)
!
!         try:
!             splitter=lexicon.Splitter
!         except AttributeError:
!             splitter=lexicon.lexicon.Splitter

           wordScores = OIBTree()
           last = None
***************
*** 343,349 ****

           # Convert scores to use wids:
           widScores=IIBucket()
!         getWid=lexicon.getWordId
           for word, score in wordScores.items():
               widScores[getWid(word)]=score

--- 347,356 ----

           # Convert scores to use wids:
           widScores=IIBucket()
!         try:
!             getWid=lexicon.getWordId
!         except AttributeError:
!             getWid=lexicon.lexicon.getWordId
           for word, score in wordScores.items():
               widScores[getWid(word)]=score

--
Steve Alexander
Software Engineer
Cat-Box limited