Commit a8f9f357 authored by Ken Manheimer's avatar Ken Manheimer

Do not fall through silently if the specified type is invalid! We now

raise an error (there should be some standard index error class).

A bit of docstring refinement.  In particular, name the index types
exactly.
parent 98f35321
......@@ -276,11 +276,9 @@ class Catalog(Persistent, Acquisition.Implicit):
self.data[key] = tuple(rec)
def addIndex(self, name, type):
"""
adds an index
"""Create a new index, of one of the following types
Currently supported are 'FieldIndexes', 'TextIndexes' and
'KeywordIndexes'.
Types: 'FieldIndex', 'TextIndex', 'KeywordIndex'.
"""
if self.indexes.has_key(name):
......@@ -297,6 +295,10 @@ class Catalog(Persistent, Acquisition.Implicit):
self.lexicon)
elif type == 'KeywordIndex':
indexes[name] = UnKeywordIndex.UnKeywordIndex(name)
else:
raise 'Unknown Index Type', ("%s invalid - must be one of %s"
% (type, ['FieldIndex', 'TextIndex',
'KeywordIndex']))
self.indexes = indexes
......
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