[Zope-Checkins] CVS: Products/PluginIndexes/TextIndex - TextIndex.py:1.9.2.6
Evan Simpson
evan@zope.com
Wed, 15 Aug 2001 16:46:10 -0400
Update of /cvs-repository/Products/PluginIndexes/TextIndex
In directory cvs.zope.org:/tmp/cvs-serv13138/TextIndex
Modified Files:
Tag: Zope-2_4-branch
TextIndex.py
Log Message:
Fix parse2 bug in TextIndex, and add a test for it.
=== Products/PluginIndexes/TextIndex/TextIndex.py 1.9.2.5 => 1.9.2.6 ===
if (len(query) != 1):
- import pdb; pdb.set_trace()
raise QueryError, "Malformed query"
return query[0]
@@ -742,13 +741,14 @@
def parse2(q, default_operator, operator_dict=operator_dict):
"""Find operators and operands"""
isop = operator_dict.has_key
- i = len(q) - 1
- while i >= 0:
+ i = 0
+ while i < len(q):
e = q[i]
if isinstance(e, ListType):
q[i] = parse2(e, default_operator)
if i % 2:
q.insert(i, default_operator)
+ i = i + 1
elif i % 2:
# This element should be an operator
if isop(e):
@@ -757,7 +757,8 @@
else:
# Insert the default operator.
q.insert(i, default_operator)
- i = i - 1
+ i = i + 1
+ i = i + 1
return q