source: main/waeup.sirp/trunk/src/waeup/sirp/university/vocabularies.py @ 6991

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

We don't need an explicit missing value in application_categories.

  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1"""Vocabularies and sources for the academics section.
2"""
3from zc.sourcefactory.basic import BasicSourceFactory
4from zope.catalog.interfaces import ICatalog
5from zope.component import getUtility
6from waeup.sirp.interfaces import SimpleWAeUPVocabulary
7
8inst_types = SimpleWAeUPVocabulary(
9    ('Faculty of','faculty'),
10    ('Department of','department'),
11    ('School of','school'),
12    ('School for','school_for'),
13    ('Institute of','institute'),
14    ('Office for','office'),
15    ('Centre for','centre'),
16    ('College','college'),
17    )
18
19course_levels = SimpleWAeUPVocabulary(
20    ('Pre-Studies',0),
21    ('100 (Year 1)',100),
22    ('200 (Year 2)',200),
23    ('300 (Year 3)',300),
24    ('400 (Year 4)',400),
25    ('500 (Year 5)',500),
26    ('600 (Year 6)',600),
27    ('700 (Year 7)',700),
28    ('800 (Year 8)',800),
29    )
30
31semester = SimpleWAeUPVocabulary(
32    ('N/A', 0),
33    ('First Semester', 1),
34    ('Second Semester', 2),
35    ('Combined', 3)
36    )
37
38application_categories = SimpleWAeUPVocabulary(
39    ('PUME, PDE, PCE, PRENCE','basic'),
40    ('Part-Time, Diploma, Certificate','cest'),
41    ('Sandwich','sandwich'),
42    ('Postgraduate','pg'),
43    )
44
45study_modes = SimpleWAeUPVocabulary(
46    ('UME Full Time','ume_ft'),
47    ('Direct Entry Full Time','de_ft'),
48    ('Diploma Full Time','dp_ft'),
49    ('Diploma Part Time','dp_pt'),
50    ('Undergraduate Full Time','ug_ft'),
51    ('Undergraduate Part Time','ug_pt'),
52    ('Postgraduate Full Time','pg_ft'),
53    ('Postgraduate Part Time','pg_pt'),
54    )
55
56
57class CourseSource(BasicSourceFactory):
58    """A course source delivers all courses inside the portal by looking
59       up a catalog.
60    """
61    def getValues(self):
62        catalog = getUtility(ICatalog, name='courses_catalog')
63        return sorted(list(
64                catalog.searchResults(
65                    code=('', 'z*'))),key=lambda value: value.code)
66
67    def getToken(self, value):
68        return value.code
69
70    def getTitle(self, value):
71        return "%s - %s" % (value.code, value.title[:64])
Note: See TracBrowser for help on using the repository browser.