Ignore:
Timestamp:
8 Mar 2012, 03:30:30 (13 years ago)
Author:
uli
Message:

Merge changes from ulif-schoolgrades back into trunk.

Location:
main/waeup.sirp/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk

  • main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py

    r7730 r7795  
    3131from zope.container.interfaces import INameChooser
    3232from zope.interface import Interface, Attribute, implements
     33from zope.schema.interfaces import IObject
    3334from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
    3435
     
    7980    )
    8081
     82SUBJECTS = dict(math=_(u'Math'),
     83                bio=_(u'Biology'),
     84                eng=_(u'English'),
     85                )
     86class SubjectSource(BasicSourceFactory):
     87    def getValues(self):
     88        return sorted(SUBJECTS.keys())
     89    def getTitle(self, value):
     90        return SUBJECTS.get(value, None)
     91
     92GRADES = {'A':_(u'Very Good'),
     93          'B':_(u'Good'),
     94          'C':_(u'Satisfactory'),
     95          'D':_(u'Sufficient'),
     96          'E':_(u'Fail'),
     97          }
     98class GradeSource(BasicSourceFactory):
     99    def getValues(self):
     100        return sorted(GRADES.keys())
     101    def getTitle(self, value):
     102        return GRADES.get(value, None)
     103
    81104# Define a valiation method for email addresses
    82105class NotAnEmailAddress(schema.ValidationError):
     
    145168        return value
    146169
     170class IResultEntry(Interface):
     171    """A school grade entry.
     172    """
     173    subject = schema.Choice(
     174        title = _(u'Subject'),
     175        source = SubjectSource(),
     176        )
     177    grade = schema.Choice(
     178        title = _(u'Grade'),
     179        source = GradeSource(),
     180        )
     181
     182class IResultEntryField(IObject):
     183    """A zope.schema-like field for usage in interfaces.
     184
     185    Marker interface to distuingish result entries from ordinary
     186    object fields. Needed for registration of widgets.
     187    """
     188
    147189class ISIRPUtils(Interface):
    148190    """A collection of methods which are subject to customization.
     
    9701012        required = True,
    9711013        )
    972 
Note: See TracChangeset for help on using the changeset viewer.