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

Tres Seaver tseaver@zope.com
Sat, 13 Oct 2001 16:24:20 -0400


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

Modified Files:
      Tag: tseaver-pxtestcleanup-branch
	TextIndex.py 
Log Message:


 - Refactored tests into subdirectories under their respective packages.

 - Removed dependency of tests on 'execfile( "framework.py" )'

 - TextIndex/TextIndex.py: replaced corrected use of 'insintance', rather
   than using 'type'.

 - Ensured that tests which need to catch logged errors don't leave
   the logger in a hosed state.


=== Zope/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py 1.20 => 1.20.2.1 ===
     def get_operands(self, q, i):
         """Evaluate and return the left and right operands for an operator"""
-
         try:
             left  = q[i - 1]
             right = q[i + 1]
@@ -631,7 +630,7 @@
         operandType = type(left)
         if operandType is IntType:
             left = self[left]
-        elif operandType in (StringType,UnicodeType): 
+        elif isinstance(left,StringType) or isinstance(left,UnicodeType):
             left = self[left]        
         elif operandType is ListType:
             left = self.evaluate(left)
@@ -639,7 +638,7 @@
         operandType = type(right)
         if operandType is IntType:
             right = self[right]
-        elif operandType in (StringType,UnicodeType): 
+        elif isinstance(right,StringType) or isinstance(right,UnicodeType):
             right = self[right]       
         elif operandType is ListType:
             right = self.evaluate(right)