Package zope :: Package schema :: Module vocabulary :: Class SimpleVocabulary
[show private | hide private]
[frames | no frames]

Type SimpleVocabulary

object --+
         |
        SimpleVocabulary


Vocabulary that works from a sequence of terms.
Method Summary
  __init__(self, terms, *interfaces)
Initialize the vocabulary given a list of terms.
  __contains__(self, value)
See zope.schema.interfaces.IBaseVocabulary
  __iter__(self)
See zope.schema.interfaces.IIterableVocabulary
  __len__(self)
See zope.schema.interfaces.IIterableVocabulary
  createTerm(cls, *args)
Create a single term from data. (Class method)
  fromItems(cls, items, *interfaces)
Construct a vocabulary from a list of (token, value) pairs. (Class method)
  fromValues(cls, values, *interfaces)
Construct a vocabulary from a simple list. (Class method)
  getTerm(self, value)
See zope.schema.interfaces.IBaseVocabulary
  getTermByToken(self, token)
See zope.schema.interfaces.IVocabularyTokenized
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
Implements __implemented__ = <implementedBy zope.schema.vocabulary....
ClassProvides __providedBy__ = <zope.interface.declarations.ClassProvi...
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...

Instance Method Details

__init__(self, terms, *interfaces)
(Constructor)

Initialize the vocabulary given a list of terms.

The vocabulary keeps a reference to the list of terms passed in; it should never be modified while the vocabulary is used.

One or more interfaces may also be provided so that alternate widgets may be bound without subclassing.
Overrides:
__builtin__.object.__init__

__contains__(self, value)
(In operator)

See zope.schema.interfaces.IBaseVocabulary

__iter__(self)

See zope.schema.interfaces.IIterableVocabulary

__len__(self)
(Length operator)

See zope.schema.interfaces.IIterableVocabulary

getTerm(self, value)

See zope.schema.interfaces.IBaseVocabulary

getTermByToken(self, token)

See zope.schema.interfaces.IVocabularyTokenized

Class Method Details

createTerm(cls, *args)

Create a single term from data.

Subclasses may override this with a class method that creates a term of the appropriate type from the arguments.

fromItems(cls, items, *interfaces)

Construct a vocabulary from a list of (token, value) pairs.

The order of the items is preserved as the order of the terms in the vocabulary. Terms are created by calling the class method createTerm() with the pair (value, token).

One or more interfaces may also be provided so that alternate widgets may be bound without subclassing.

fromValues(cls, values, *interfaces)

Construct a vocabulary from a simple list.

Values of the list become both the tokens and values of the terms in the vocabulary. The order of the values is preserved as the order of the terms in the vocabulary. Tokens are created by calling the class method createTerm() with the value as the only parameter.

One or more interfaces may also be provided so that alternate widgets may be bound without subclassing.

Class Variable Details

__implemented__

Type:
Implements
Value:
<implementedBy zope.schema.vocabulary.SimpleVocabulary>                

__providedBy__

Type:
ClassProvides
Value:
<zope.interface.declarations.ClassProvides object at 0xb6505c6c>       

__provides__

Type:
ClassProvides
Value:
<zope.interface.declarations.ClassProvides object at 0xb6505c6c>       

Generated by Epydoc 2.1 on Fri Jun 24 12:01:25 2005 http://epydoc.sf.net