[Checkins] SVN: Products.ZCTextIndex/trunk/ - removed BBB code for instances created with Zope < 2.6.2

Yvo Schubbe y.2010 at wcm-solutions.de
Sat Aug 14 05:45:52 EDT 2010


Log message for revision 115675:
  - removed BBB code for instances created with Zope < 2.6.2

Changed:
  U   Products.ZCTextIndex/trunk/CHANGES.txt
  UU  Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/Lexicon.py
  UU  Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/tests/testLexicon.py

-=-
Modified: Products.ZCTextIndex/trunk/CHANGES.txt
===================================================================
--- Products.ZCTextIndex/trunk/CHANGES.txt	2010-08-13 18:50:23 UTC (rev 115674)
+++ Products.ZCTextIndex/trunk/CHANGES.txt	2010-08-14 09:45:51 UTC (rev 115675)
@@ -4,6 +4,8 @@
 2.13.1 (unreleased)
 -------------------
 
+- Lexicon: Removed BBB code for instances created with Zope < 2.6.2.
+
 - Added missing namespace_packages declaration to setup.py.
 
 2.13.0 (2010-06-19)

Modified: Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/Lexicon.py
===================================================================
--- Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/Lexicon.py	2010-08-13 18:50:23 UTC (rev 115674)
+++ Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/Lexicon.py	2010-08-14 09:45:51 UTC (rev 115675)
@@ -12,8 +12,6 @@
 #
 ##############################################################################
 """Lexicon.
-
-$Id$
 """
 
 import re
@@ -46,9 +44,10 @@
         self._pipeline = pipeline
 
     def length(self):
-        """Return the number of unique terms in the lexicon."""
-        # Overridden in instances
-        return len(self._wids)
+        """Return the number of unique terms in the lexicon.
+        """
+        # Overridden in instances with a BTrees.Length.Length
+        raise NotImplementedError
 
     def words(self):
         return self._wids.keys()
@@ -63,9 +62,6 @@
         last = _text2list(text)
         for element in self._pipeline:
             last = element.process(last)
-        if not hasattr(self.length, 'change'):
-            # Make sure length is overridden with a BTrees.Length.Length
-            self.length = Length(self.length())        
         # Strategically unload the length value so that we get the most
         # recent value written to the database to minimize conflicting wids
         # Because length is independent, this will load the most


Property changes on: Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/Lexicon.py
___________________________________________________________________
Deleted: svn:keywords
   - Id

Modified: Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/tests/testLexicon.py
===================================================================
--- Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/tests/testLexicon.py	2010-08-13 18:50:23 UTC (rev 115674)
+++ Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/tests/testLexicon.py	2010-08-14 09:45:51 UTC (rev 115675)
@@ -12,8 +12,6 @@
 #
 ##############################################################################
 """Lexicon unit tests.
-
-$Id$
 """
 
 import unittest
@@ -71,7 +69,7 @@
 
 class Test(unittest.TestCase):
 
-    def test_z3interfaces(self):
+    def test_interfaces(self):
         from Products.ZCTextIndex.interfaces import ILexicon
         from zope.interface.verify import verifyClass
 
@@ -171,16 +169,10 @@
         words = HTMLWordSplitter().process(words)
         self.assertEqual(words, expected)
         locale.setlocale(locale.LC_ALL, loc) # restore saved locale
-        
-    def testUpgradeLength(self):
-        from BTrees.Length import Length
-        lexicon = Lexicon(Splitter())
-        del lexicon.length # Older instances don't override length
-        lexicon.sourceToWordIds('how now brown cow')
-        self.assert_(lexicon.length.__class__ is Length)        
-        
+
+
 class TestLexiconConflict(unittest.TestCase):
-    
+
     db = None
 
     def tearDown(self):
@@ -226,6 +218,3 @@
     suite.addTest(unittest.makeSuite(Test))
     suite.addTest(unittest.makeSuite(TestLexiconConflict))
     return suite
-
-if __name__=='__main__':
-    unittest.main(defaultTest='test_suite')


Property changes on: Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/tests/testLexicon.py
___________________________________________________________________
Deleted: svn:keywords
   - Id



More information about the checkins mailing list