Hiya, ... lots cut ... I like the _populateIndexes() method. Having a single pass without a signifying parameter makes it easier to understand. Am 06.02.2012, 10:12 Uhr, schrieb Jan-Carel Brand <lists@opkode.com>:
A vocabulary must minimally be able to determine whether it contains a value, to create a term object for a value, and to return a query interface (or None) to find items in itself.
So it looks like someone thinks that any vocabulary must be able to create a term object. Thoughts on that?
Yes: I think it's much more important to define what kind of terms are expected. Apart from local utilities I've never come across the need to add terms individually and even then term generation is outside the scope of the vocabulary as you already have a term factory. Validating terms seems more important so I guess and __setitem__() method which imposes the same checks as you run in _populateIndexes() might be worthwhile to stop the index being fouled up by application code.
I think I'm now finished and have implemented everybody's suggestions and improvements.
The TreeVocabulary now has a terms_factory attribute which is an OrderedDict by default and which can be overridden in a subclass to an alternative datastructure. It also implements IEnumerableMapping. All the TreeVocabulary methods are covered by tests and I tested with Python 2.6 and Python 2.7. If there aren't any more objections, I'd like to now merge with trunk.
I think it's okay to go ahead and merge. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Kronenstr. 27a Düsseldorf D- 40217 Tel: +49-211-600-3657 Mobile: +49-178-782-6226