[Zope3-dev] question about IVocabulary

Fred L. Drake, Jr. fred@zope.com
Tue, 15 Jul 2003 12:59:11 -0400


Garrett Smith writes:
 > The example provided in vocabularies.txt does not implement two methods
 > that are a part of IVocabulary:
 > 
 >   getQuery() and getTerm(value)

Good catch; this is now fixed.

 > More importantly, should getQuery be in IVocabluary? I would have
 > expected something like this to be in an IQueriableVocabulary mixin.

We had started out this way, but decided that simplicity was better;
mixing together too many interfaces usually ends up making things hard
to track down.

A complex vocabulary will often want to implement some sort of search
functionality, in which case it needs to implement getQuery() anyway,
and a simple vocabulary can often easily enough define this or
subclass from zope.schema.vocabulary.SimpleVocabulary.


  -Fred

-- 
Fred L. Drake, Jr.  <fred at zope.com>
PythonLabs at Zope Corporation