[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndexNG - GlobbingLexiconNG.py:1.1.2.6
Andreas Jung
andreas@digicool.com
Fri, 11 Jan 2002 16:49:11 -0500
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndexNG
In directory cvs.zope.org:/tmp/cvs-serv30751
Modified Files:
Tag: ajung-textindexng-branch
GlobbingLexiconNG.py
Log Message:
changed return type of get() to IISet() to be compliant with all
other lexicons
=== Zope/lib/python/Products/PluginIndexes/TextIndexNG/GlobbingLexiconNG.py 1.1.2.5 => 1.1.2.6 ===
"""
- multi_wc = '*'
+ multi_wc = '*'
single_wc = '?'
- eow = '$'
+ eow = '$'
wc_set = [multi_wc, single_wc]
glob_reg = re.compile('[\?\*]')
@@ -135,15 +135,20 @@
# This NEEDS to be fixed because the splitter can now produce
# single characters
- if len(pattern)==1: return ()
+
+ r = IISet()
+
+ if len(pattern)==1: return r
# no globbing
- if not glob_reg.match(pattern):
+ if not self.glob_reg.match(pattern):
result = self._lexicon.get(pattern, None)
- if result is None: return ()
- else: return (result, )
+ if result is None: return r
+ else:
+ r.insert(result)
+ return r
# we are in globbing country
@@ -174,7 +179,8 @@
result=union(result, self._digrams.get(digram, None))
if not result:
- return ()
+ # should return None
+ return r
else: