Commit c6dcd73c authored by Jim Fulton's avatar Jim Fulton

Added logic to allow "blank" inputs.

parent e6da6538
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
__doc__='''Simple column indexes __doc__='''Simple column indexes
$Id: Index.py,v 1.4 1997/09/10 21:46:18 jim Exp $''' $Id: Index.py,v 1.5 1997/09/12 14:18:04 jim Exp $'''
__version__='$Revision: 1.4 $'[11:-2] __version__='$Revision: 1.5 $'[11:-2]
from BTree import BTree from BTree import BTree
from intSet import intSet from intSet import intSet
...@@ -124,23 +124,31 @@ class Index: ...@@ -124,23 +124,31 @@ class Index:
try: keys=request[id] try: keys=request[id]
except: return None except: return None
if type(keys) is not ListType: keys=[keys] if type(keys) is ListType: keys=[keys]
index=self._index index=self._index
r=None r=None
anyTrue=0
for key in keys: for key in keys:
if key: anyTrue=1
try: try:
set=index[key] set=index[key]
if r is None: r=set if r is None: r=set
else: r = r.union(set) else: r = r.union(set)
except KeyError: pass except KeyError: pass
if r is None: r=intSet() if r is None:
if anyTrue: r=intSet()
else: return None
return r, (id,) return r, (id,)
############################################################################## ##############################################################################
# #
# $Log: Index.py,v $ # $Log: Index.py,v $
# Revision 1.5 1997/09/12 14:18:04 jim
# Added logic to allow "blank" inputs.
#
# Revision 1.4 1997/09/10 21:46:18 jim # Revision 1.4 1997/09/10 21:46:18 jim
# Fixed bug that caused return of None when there were no matches. # Fixed bug that caused return of None when there were no matches.
# #
......
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