Commit 130af9ce authored by Guido van Rossum's avatar Guido van Rossum

_apply_index(): return None when the query string is empty.

I'm unclear whether this is really the right thing, but at least this
prevents crashes when nothing is entered in the search box.
parent 68957496
...@@ -118,6 +118,8 @@ class ZCTextIndex(Persistent, Acquisition.Implicit, SimpleItem): ...@@ -118,6 +118,8 @@ class ZCTextIndex(Persistent, Acquisition.Implicit, SimpleItem):
if record.keys is None: if record.keys is None:
return None return None
query_str = ' '.join(record.keys) query_str = ' '.join(record.keys)
if not query_str:
return None
tree = QueryParser(self.lexicon).parseQuery(query_str) tree = QueryParser(self.lexicon).parseQuery(query_str)
results = tree.executeQuery(self.index) results = tree.executeQuery(self.index)
return results, (self._fieldname,) return results, (self._fieldname,)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment