Ignore:
Timestamp:
16 Nov 2012, 21:56:03 (12 years ago)
Author:
Henrik Bettermann
Message:

Ease customization of MODE_GROUPS.

File:
1 edited

Legend:

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

    r9648 r9649  
    2121from zope.interface import implementer, Interface
    2222from waeup.kofa.interfaces import (
    23      academic_sessions_vocab, registration_states_vocab)
     23    IKofaUtils,
     24    academic_sessions_vocab, registration_states_vocab)
    2425from waeup.kofa.interfaces import MessageFactory as _
    2526from waeup.kofa.reports import IReport
    26 
    27 MODE_GROUPS = {
    28     'All':('all',),
    29     'Undergraduate Full-Time':('ug_ft',),
    30     'Undergraduate Part-Time':('ug_pt',),
    31     'Postgraduate Full-Time':('pg_ft',),
    32     'Postgraduate Part-Time':('pg_pt',),
    33     }
    3427
    3528class IStudentReport(IReport):
     
    6861    result = cat.searchResults(current_session=(session, session))
    6962    table = [[0 for x in xrange(len(states))] for y in xrange(len(fac_codes))]
     63    mode_groups = getUtility(IKofaUtils).MODE_GROUPS
    7064    for stud in result:
    71         if mode != 'All' and stud.current_mode not in MODE_GROUPS[mode]:
     65        if mode != 'All' and stud.current_mode not in mode_groups[mode]:
    7266            continue
    7367        row = fac_codes.index(stud.faccode)
     
    221215
    222216    def _set_mode_values(self):
    223         self.modes = sorted([(key, key) for key in MODE_GROUPS.keys()])
     217        mode_groups = getUtility(IKofaUtils).MODE_GROUPS
     218        self.modes = sorted([(key, key) for key in mode_groups.keys()])
    224219        return
    225220
Note: See TracChangeset for help on using the changeset viewer.