source: main/waeup.sirp/trunk/src/waeup/sirp/applicants/vocabularies.py @ 6842

Last change on this file since 6842 was 6744, checked in by Henrik Bettermann, 13 years ago

Remove trash.

Rename entry_session_vocab and other academic session related things because of the ambiguity of the term 'session'. We should always use one of the following terms: entry session, current session or academic session.

  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1"""Vocabularies and sources for the application section.
2"""
3from datetime import datetime
4from zope.component import getUtility
5from zope.catalog.interfaces import ICatalog
6from zc.sourcefactory.basic import BasicSourceFactory
7from zc.sourcefactory.contextual import BasicContextualSourceFactory
8from waeup.sirp.interfaces import SimpleWAeUPVocabulary
9from waeup.sirp.students.lgas import LGAS
10from waeup.sirp.students.vocabularies import (
11    CertificateSource, GenderSource)
12
13#: Types of applications we support.
14APPLICATION_TYPES = (
15    ('General Studies', 'app','APP'),
16    ('Pre-NCE Programme', 'prence','PRE'),
17    ('Post UME Screening Test', 'pume','PUME'),
18    ('Post UDE Screening', 'pude','PUDE'),
19    ('Part Time Degree in Education', 'sandwich','SAND'),
20    ('Part-Time Degree Programmes', 'pt','PTP'),
21    ('Diploma Programmes', 'dp','DPP'),
22    ('PCE Screening', 'pce','PCE'),
23    ('Certificate Programmes', 'ct','CTP'),
24    ('Common Entry Screening Test', 'cest','CEST'),
25    )
26
27#: A :class:`waeup.sirp.interfaces.SimpleWAeUPVocabulary` of supported
28#: application or screening types.
29application_types_vocab = SimpleWAeUPVocabulary(
30    *[(x[0],x[1]) for x in APPLICATION_TYPES])
31application_pins_vocab = SimpleWAeUPVocabulary(
32    *[(u"%s (%s)" % (x[2],x[0]),x[2]) for x in APPLICATION_TYPES])
33
34
35class AppCatCertificateSource(CertificateSource):
36    """An application certificate source delivers all courses which belong to
37    a certain application_category.
38    """
39    def getValues(self, context):
40        appcat = context.__parent__.application_category
41        catalog = getUtility(ICatalog, name='certificates_catalog')
42        return sorted(list(
43                catalog.searchResults(
44                    code=('', 'z*'),
45                    application_category=(appcat,appcat))),
46                    key=lambda value: value.code)
Note: See TracBrowser for help on using the repository browser.