[Zope-Checkins] CVS: Zope2 - TextIndex.py:1.9

andreas@serenade.digicool.com andreas@serenade.digicool.com
Tue, 19 Jun 2001 08:38:33 -0400


Update of /cvs-repository/Zope2/lib/python/Products/PluginIndexes/TextIndex
In directory serenade:/tmp/cvs-serv18122

Modified Files:
	TextIndex.py 
Log Message:
added warning when using deprecated textindex_operator



--- Updated File TextIndex.py in package Zope2 --
--- TextIndex.py	2001/06/15 13:43:09	1.8
+++ TextIndex.py	2001/06/19 12:38:33	1.9
@@ -95,7 +95,7 @@
 
 
 import string, re
-import operator
+import operator,warnings
 from Globals import Persistent,DTMLFile
 from zLOG import LOG, ERROR
 from OFS.SimpleItem import SimpleItem
@@ -510,7 +510,8 @@
 
         query_operator = record.get('operator',self.useOperator)
         if not query_operator in self.operators.keys():
-            raise exceptions.RuntimeError,"Invalid operator '%s' for a TextIndex" % query_operator
+            raise exceptions.RuntimeError,"Invalid operator '%s' for a TextIndex"\
+                     % query_operator
 
         # We keep this for pre-2.4 compatibility
         # This stinking code should go away somewhere. A global
@@ -520,6 +521,8 @@
 
         if request.has_key('textindex_operator'):
             query_operator = request['textindex_operator']
+            warnings.warn("The usage of the 'textindex_operator' is no longer recommended.\n"\
+                          "Please use a mapping object and the 'operator' to specify the operator")
 
         r = None