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

Last change on this file since 6100 was 6100, checked in by uli, 13 years ago

Remove source needed elsewhere (rule of thumb: no imports from one
subpackage to another if avoidable).

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