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