Changeset 7619 for main/waeup.sirp/trunk


Ignore:
Timestamp:
9 Feb 2012, 16:22:05 (13 years ago)
Author:
Henrik Bettermann
Message:

Add getVerdictsDict method to SIRPUtils which is used to setup the new VerdictSource?.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py

    r7608 r7619  
    171171        """
    172172
     173    def getVerdictsDict():
     174        """Provide a dict of verdicts.
     175        """
     176
    173177class ISIRPObject(Interface):
    174178    """A SIRP object.
  • main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py

    r7554 r7619  
    2424from waeup.sirp.university.vocabularies import CourseSource, study_modes
    2525from waeup.sirp.students.vocabularies import (
    26   CertificateSource, verdicts, StudyLevelSource,
     26  CertificateSource, VerdictSource, StudyLevelSource,
    2727  contextual_reg_num_source, contextual_mat_num_source,
    2828  GenderSource, nats_vocab,
     
    257257        )
    258258
    259 
    260259    entry_mode = schema.Choice(
    261260        title = u'Entry Mode',
     
    293292    current_verdict = schema.Choice(
    294293        title = u'Current Verdict',
    295         source = verdicts,
     294        source = VerdictSource(),
    296295        default = '0',
    297296        required = False,
     
    300299    previous_verdict = schema.Choice(
    301300        title = u'Previous Verdict',
    302         source = verdicts,
     301        source = VerdictSource(),
    303302        default = '0',
    304303        required = False,
     
    322321    level_verdict = schema.Choice(
    323322        title = u'Verdict',
    324         source = verdicts,
     323        source = VerdictSource(),
    325324        default = '0',
    326325        required = False,
  • main/waeup.sirp/trunk/src/waeup/sirp/students/vocabularies.py

    r7617 r7619  
    2525from zc.sourcefactory.basic import BasicSourceFactory
    2626from zc.sourcefactory.contextual import BasicContextualSourceFactory
    27 from waeup.sirp.interfaces import SimpleSIRPVocabulary
     27from waeup.sirp.interfaces import SimpleSIRPVocabulary, ISIRPUtils
    2828from waeup.sirp.students.lgas import LGAS
    2929from waeup.sirp.students.nats import NATS
     
    8686        return title
    8787
    88 verdicts = SimpleSIRPVocabulary(
    89     ('not yet','0'),
    90     ('Successful student','A'),
    91     ('Student with carryover courses','B'),
    92     ('Student on probation','C'),
    93     ('Withdrawn from the faculty','D'),
    94     ('Student who were previously on probation','E'),
    95     ('Medical case','F'),
    96     ('Absent from examination','G'),
    97     ('Withheld results','H'),
    98     ('Expelled/rusticated/suspended student','I'),
    99     ('Temporary withdrawn from the university','J'),
    100     ('Unregistered student','K'),
    101     ('Referred student','L'),
    102     ('Reinstatement','M'),
    103     ('Student on transfer','N'),
    104     ('NCE-III repeater','O'),
    105     ('New 300 level student','X'),
    106     ('No previous verdict','Y'),
    107     ('Successful student (provisional)','Z'),
    108     ('First Class','A1'),
    109     ('Second Class Upper','A2'),
    110     ('Second Class Lower','A3'),
    111     ('Third Class','A4'),
    112     ('Pass','A5'),
    113     ('Distinction','A6'),
    114     ('Credit','A7'),
    115     ('Merit','A8'),
    116     )
     88class VerdictSource(BasicContextualSourceFactory):
     89    """A verdicts source delivers all verdicts provided
     90    in the portal.
     91    """
    11792
     93    def getValues(self, context):
     94        self.verdicts_dict = getUtility(ISIRPUtils).getVerdictsDict()
     95        return self.verdicts_dict.keys()
     96
     97    def getToken(self, context, value):
     98        return value
     99
     100    def getTitle(self, context, value):
     101        return self.verdicts_dict[value]
    118102
    119103class CertificateSource(BasicContextualSourceFactory):
  • main/waeup.sirp/trunk/src/waeup/sirp/utils/utils.py

    r7585 r7619  
    108108        return send_mail(
    109109            from_name,from_addr,rcpt_name,rcpt_addr,subject,body,config)
     110
     111
     112    def getVerdictsDict(self):
     113        """Provide a dictionary of verdicts.
     114        """
     115        return {
     116            'A1': 'First Class',
     117            '0': 'not yet',
     118            'A3': 'Second Class Lower',
     119            'A2': 'Second Class Upper',
     120            'A5': 'Pass',
     121            'A4': 'Third Class',
     122            'A7': 'Credit',
     123            'A6': 'Distinction',
     124            'A8': 'Merit',
     125            'A': 'Successful student',
     126            'C': 'Student on probation',
     127            'B': 'Student with carryover courses',
     128            'E': 'Student who were previously on probation',
     129            'D': 'Withdrawn from the faculty',
     130            'G': 'Absent from examination',
     131            'F': 'Medical case',
     132            'I': 'Expelled/rusticated/suspended student',
     133            'H': 'Withheld results',
     134            'K': 'Unregistered student',
     135            'J': 'Temporary withdrawn from the university',
     136            'M': 'Reinstatement',
     137            'L': 'Referred student',
     138            'O': 'NCE-III repeater',
     139            'N': 'Student on transfer',
     140            'Y': 'No previous verdict',
     141            'X': 'New 300 level student',
     142            'Z': 'Successful student (provisional)'}
Note: See TracChangeset for help on using the changeset viewer.