Ignore:
Timestamp:
1 Aug 2009, 08:35:43 (15 years ago)
Author:
uli
Message:

Make vocabulary support tokens.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/interfaces.py

    r4509 r4512  
    33from zope.interface import Interface, Attribute
    44from zope import schema
    5 from zope.schema.vocabulary import SimpleVocabulary
     5from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
    66from waeup.permissions import RoleSource
     7
     8def SimpleWAeUPVocabulary(*terms):
     9    """A well-buildt vocabulary provides terms with a value, token and
     10       title for each term
     11    """
     12    return SimpleVocabulary([
     13            SimpleTerm(value, value, title) for title, value in terms])
    714
    815class IWAeUPObject(Interface):
     
    157164        title = u'Semester/Term',
    158165        default = 0,
    159         vocabulary = SimpleVocabulary.fromItems([
    160                 ('N/A', 0), ('First Semester', 1),
    161                 ('Second Semester', 2), ('Combined', 3),]),
     166        vocabulary = SimpleWAeUPVocabulary(
     167            ('N/A', 0), ('First Semester', 1),
     168            ('Second Semester', 2), ('Combined', 3)),
    162169        required = True,
    163170        )
Note: See TracChangeset for help on using the changeset viewer.