Ignore:
Timestamp:
19 Mar 2012, 06:52:50 (13 years ago)
Author:
uli
Message:

Make grade source work with the modified EXAM_GRADES from kofa utils.

File:
1 edited

Legend:

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

    r7907 r7918  
    8181
    8282class SubjectSource(BasicSourceFactory):
    83 
     83    """A source for school subjects used in exam documentation.
     84    """
    8485    def getValues(self):
    8586        subjects_dict = getUtility(IKofaUtils).EXAM_SUBJECTS_DICT
     
    9192
    9293class GradeSource(BasicSourceFactory):
    93 
     94    """A source for exam grades.
     95    """
    9496    def getValues(self):
    95         grades_dict = getUtility(IKofaUtils).EXAM_GRADES_DICT
    96         return [value[0] for value in
    97             sorted(grades_dict.items(), key=lambda item: item[1][0])]
     97        for entry in getUtility(IKofaUtils).EXAM_GRADES:
     98            yield entry[0]
    9899
    99100    def getTitle(self, value):
    100         grades_dict = getUtility(IKofaUtils).EXAM_GRADES_DICT
    101         return grades_dict[value][1]
     101        return dict(getUtility(IKofaUtils).EXAM_GRADES)[value]
    102102
    103103# Define a validation method for email addresses
Note: See TracChangeset for help on using the changeset viewer.