Ignore:
Timestamp:
7 Mar 2012, 09:06:12 (13 years ago)
Author:
uli
Message:

Move grade and subject sources to central interfaces. They are needed in several submodules.

Location:
main/waeup.sirp/branches/ulif-schoolgrades/src/waeup/sirp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/branches/ulif-schoolgrades/src/waeup/sirp/applicants/interfaces.py

    r7770 r7772  
    3131from waeup.sirp.schema import TextLineChoice
    3232from waeup.sirp.interfaces import (
    33     ISIRPObject, year_range, validate_email, academic_sessions_vocab)
     33    ISIRPObject, year_range, validate_email, academic_sessions_vocab,
     34    SubjectSource, GradeSource)
    3435from waeup.sirp.interfaces import MessageFactory as _
    3536from waeup.sirp.university.vocabularies import (
     
    7980directlyProvides(contextual_reg_num_source, IContextSourceBinder)
    8081
    81 SUBJECTS = dict(math=_(u'Math'),
    82                 bio=_(u'Biology'),
    83                 eng=_(u'English'),
    84                 )
    85 class SubjectSource(BasicSourceFactory):
    86     def getValues(self):
    87         return sorted(SUBJECTS.keys())
    88     def getTitle(self, value):
    89         return SUBJECTS.get(value, None)
    90 
    91 GRADES = {'A':_(u'Very Good'),
    92           'B':_(u'Good'),
    93           'C':_(u'Satisfactory'),
    94           'D':_(u'Sufficient'),
    95           'E':_(u'Fail'),
    96           }
    97 class GradeSource(BasicSourceFactory):
    98     def getValues(self):
    99         return sorted(GRADES.keys())
    100     def getTitle(self, value):
    101         return GRADES.get(value, None)
    10282
    10383class AppCatCertificateSource(CertificateSource):
     
    384364    #    )
    385365    grade = schema.Choice(
    386         title = _(u'Grafde'),
     366        title = _(u'Grade'),
    387367        source = GradeSource(),
    388368        )
  • main/waeup.sirp/branches/ulif-schoolgrades/src/waeup/sirp/interfaces.py

    r7730 r7772  
    7979    )
    8080
     81SUBJECTS = dict(math=_(u'Math'),
     82                bio=_(u'Biology'),
     83                eng=_(u'English'),
     84                )
     85class SubjectSource(BasicSourceFactory):
     86    def getValues(self):
     87        return sorted(SUBJECTS.keys())
     88    def getTitle(self, value):
     89        return SUBJECTS.get(value, None)
     90
     91GRADES = {'A':_(u'Very Good'),
     92          'B':_(u'Good'),
     93          'C':_(u'Satisfactory'),
     94          'D':_(u'Sufficient'),
     95          'E':_(u'Fail'),
     96          }
     97class GradeSource(BasicSourceFactory):
     98    def getValues(self):
     99        return sorted(GRADES.keys())
     100    def getTitle(self, value):
     101        return GRADES.get(value, None)
     102
    81103# Define a valiation method for email addresses
    82104class NotAnEmailAddress(schema.ValidationError):
Note: See TracChangeset for help on using the changeset viewer.