[Zope-CVS] CVS: Products/ZCTextIndex - ZCTextIndex.py:1.6

Jeremy Hylton jeremy@zope.com
Tue, 14 May 2002 16:37:11 -0400


Update of /cvs-repository/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv30738

Modified Files:
	ZCTextIndex.py 
Log Message:
Some cosmetic changes

Re-order imports so that all Zope imports go together and are separate
from all the ZCTextIndex imports.

Reformat _apply_index() doc string to use std Python style, which is
one-line summary followed by paragraphs of text that start at the same
offset as the function name.

Do comparison of None using is instead of ==.


=== Products/ZCTextIndex/ZCTextIndex.py 1.5 => 1.6 ===
 from OFS.SimpleItem import SimpleItem
 
+from Globals import DTMLFile, InitializeClass
+from Interface import verify_class_implementation
+from AccessControl.SecurityInfo import ClassSecurityInfo
+
 from Products.PluginIndexes.common.PluggableIndex \
      import PluggableIndexInterface
 from Products.PluginIndexes.common.util import parseIndexRequest
@@ -29,9 +33,6 @@
      import Lexicon, Splitter, CaseNormalizer, StopWordRemover
 from Products.ZCTextIndex.NBest import NBest
 from Products.ZCTextIndex.QueryParser import QueryParser
-from Globals import DTMLFile, InitializeClass
-from Interface import verify_class_implementation
-from AccessControl.SecurityInfo import ClassSecurityInfo
 
 class ZCTextIndex(Persistent, Acquisition.Implicit, SimpleItem):
     """Persistent TextIndex"""
@@ -76,23 +77,21 @@
         self._p_changed = 1 # XXX
 
     def _apply_index(self, request, cid=''):
-        """Apply the query specified by request which is a mapping
-           containing the query 
+        """Apply query specified by request, a mapping containing the query.
            
-           Returns two object on success, the resultSet containing the
-           matching record numbers and a tuple containing the names of the
-           fields used
+        Returns two object on success, the resultSet containing the
+        matching record numbers and a tuple containing the names of
+        the fields used
 
-           Returns None if request is not valid for this index.
+        Returns None if request is not valid for this index.
         """
         record = parseIndexRequest(request, self.id, self.query_options)
-        if record.keys==None: 
+        if record.keys is None: 
             return None
         query_str = ' '.join(record.keys)
         tree = self.parser.parseQuery(query_str)
         results = tree.executeQuery(self.index)
         return  results, (self._fieldname,)
-        
 
     def query(self, query, nbest=10):
         # returns a mapping from docids to scores