[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndex - TextIndex.py:1.9.2.4

Andreas Jung andreas@zope.com
Wed, 8 Aug 2001 14:03:03 -0400


Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndex
In directory cvs.zope.org:/tmp/cvs-serv28513/PluginIndexes/TextIndex

Modified Files:
      Tag: Zope-2_4-branch
	TextIndex.py 
Log Message:
Fixed aquisition of the vocabulary for a TextIndex from the ZCatalog.


=== Zope/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py 1.9.2.3 => 1.9.2.4 ===
         self.clear()
 
-        if extra:   self.vocabulary_id = extra.vocabulary
-        else:       self.vocabulary_id = "Vocabulary"
+        if extra:   
+            self.vocabulary_id = extra.vocabulary
+            self.catalog       = extra.catalog
+        else:           
+            self.vocabulary_id = "Vocabulary"
+            self.catalog       = None
+
+        
 
         self._lexicon = None
 
@@ -198,13 +204,16 @@
             self.vocabulary_id = '__userdefined__'
 
 
+
     def getLexicon(self, vocab_id=None):
         """Return the Lexicon in use. Removed lots of stinking code"""
 
+        
+
         if self._lexicon is None:
             ## if no lexicon is provided, create a default one
             try:
-                self._lexicon = self.aq_parent.getattr(self.vocabulary_id).getLexicon()
+                self._lexicon = getattr(self.catalog,self.vocabulary_id).getLexicon()
             except:                
                 self._lexicon = Lexicon()
                 self.vocabulary_id = '__intern__'
@@ -348,6 +357,7 @@
             return 0
         
         lexicon = self.getLexicon()
+
         splitter = lexicon.Splitter
 
         wordScores = OIBTree()