1 | ## $Id: utils.py 8444 2012-05-14 10:04:25Z henrik $ |
---|
2 | ## |
---|
3 | ## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann |
---|
4 | ## This program is free software; you can redistribute it and/or modify |
---|
5 | ## it under the terms of the GNU General Public License as published by |
---|
6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
7 | ## (at your option) any later version. |
---|
8 | ## |
---|
9 | ## This program is distributed in the hope that it will be useful, |
---|
10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | ## GNU General Public License for more details. |
---|
13 | ## |
---|
14 | ## You should have received a copy of the GNU General Public License |
---|
15 | ## along with this program; if not, write to the Free Software |
---|
16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | ## |
---|
18 | """Customize general helper utilities for Kofa. |
---|
19 | """ |
---|
20 | import os |
---|
21 | import pytz |
---|
22 | from waeup.kofa.utils.utils import KofaUtils, sorted_phone_prefixes |
---|
23 | from waeup.aaue.interfaces import MessageFactory as _ |
---|
24 | |
---|
25 | INT_PHONE_PREFIXES = [ |
---|
26 | (1, _('Nigeria'), '234'), |
---|
27 | (99, _('Germany'), '49'), |
---|
28 | (99, _('United States'), '1'), |
---|
29 | (99, _('Niger'), '227'), |
---|
30 | (99, _('Benin'), '229'), |
---|
31 | (99, _('Cameroon'), '237'), |
---|
32 | (99, _('United Kingdom'), '44'), |
---|
33 | (99, _('France'), '33'), |
---|
34 | ] |
---|
35 | |
---|
36 | class KofaUtils(KofaUtils): |
---|
37 | """A collection of methods subject to customization. |
---|
38 | """ |
---|
39 | PORTAL_LANGUAGE = 'en' |
---|
40 | |
---|
41 | PREFERRED_LANGUAGES_DICT = { |
---|
42 | 'en':(1, u'English'), |
---|
43 | 'fr':(2, u'Français'), |
---|
44 | 'de':(3, u'Deutsch'), |
---|
45 | } |
---|
46 | |
---|
47 | #: A function to return |
---|
48 | @classmethod |
---|
49 | def sorted_phone_prefixes(cls, data=INT_PHONE_PREFIXES, request=None): |
---|
50 | return sorted_phone_prefixes(data, request) |
---|
51 | |
---|
52 | EXAM_SUBJECTS_DICT = { |
---|
53 | 'accounts': 'Accounts', |
---|
54 | 'add_general_science': 'Add General Science', |
---|
55 | 'add_maths': 'Add Maths', |
---|
56 | 'adv_elect_install_maint': 'Adv. Electrical Installation and Maintenance', |
---|
57 | 'agricultural_science': 'Agricultural Science', |
---|
58 | 'applied_electricity': 'Applied Electricity', |
---|
59 | 'arabi': 'Arabic', |
---|
60 | 'arithmetics': 'Arithmetics', |
---|
61 | 'art': 'Art', |
---|
62 | 'auto_mechanics': 'Auto Mechanics', |
---|
63 | 'basic_electricity': 'Basic Electricity', |
---|
64 | 'bible_knowledge': 'Bible Knowledge', |
---|
65 | 'biology': 'Biology', |
---|
66 | 'biology_alt_syl': 'Biology (Alt.Syl)', |
---|
67 | 'book_keeping': 'Book Keeping', |
---|
68 | 'building_construction': 'Building Construction', |
---|
69 | 'business_management': 'Business Management', |
---|
70 | 'business_construction_management': 'Business/Construction Management (Adv)', |
---|
71 | 'chemistry': 'Chemistry', |
---|
72 | 'chemistry_alt_syl': 'Chemistry (Alt.Syl)', |
---|
73 | 'christian_religious_studies': 'Christian Religious Studies', |
---|
74 | 'class_teaching': 'Class Teaching', |
---|
75 | 'clerical_office_duties': 'Clerical Office Duties', |
---|
76 | 'clothing_and_textiles': 'Clothing and Textiles', |
---|
77 | 'commerce': 'Commerce', |
---|
78 | 'economics': 'Economics', |
---|
79 | 'education': 'Education', |
---|
80 | 'efik': 'Efik', |
---|
81 | 'electronics': 'Electronics', |
---|
82 | 'elementary_surveying': 'Elementary Surveying', |
---|
83 | 'english_language': 'English Language', |
---|
84 | 'engineering_science': 'Engineering Science', |
---|
85 | 'financial_accounting': 'Financial Accounting', |
---|
86 | 'food_and_nutrition': 'Food and Nutrition', |
---|
87 | 'french': 'French', |
---|
88 | 'further_mathematics': 'Further Mathematics', |
---|
89 | 'general_science': 'General Science', |
---|
90 | 'geography': 'Geography', |
---|
91 | 'german': 'German', |
---|
92 | 'government': 'Government', |
---|
93 | 'hausa': 'Hausa', |
---|
94 | 'hausa_literature': 'Hausa Literature', |
---|
95 | 'health_science': 'Health Science', |
---|
96 | 'history': 'History', |
---|
97 | 'home_management': 'Home Management', |
---|
98 | 'human_biology': 'Human Biology', |
---|
99 | 'industrial_electrical_installation': 'Industrial Elect Installation (Adv)', |
---|
100 | 'intergrated_science': 'Intergrated Science', |
---|
101 | 'islamic_studies': 'Islamic Studies', |
---|
102 | 'literature_in_english': 'Literature in English', |
---|
103 | 'literature_in_nigerian_languages': 'Literature in Nigerian Languages', |
---|
104 | 'igbo': 'Igbo', |
---|
105 | 'igbo_literature': 'Igbo Literature', |
---|
106 | 'yoruba': 'Yoruba', |
---|
107 | 'yoruba_literature': 'Yoruba Literature', |
---|
108 | 'management_in_living': 'Management in Living', |
---|
109 | 'mathematics': 'Mathematics', |
---|
110 | 'metalwork': 'Metalwork', |
---|
111 | 'music': 'Music', |
---|
112 | 'nigerian_language': 'Nigerian Language', |
---|
113 | 'office_practice': 'Office Practice', |
---|
114 | 'physical_education': 'Physical Education', |
---|
115 | 'physical_health_education': 'Physical and Health Education', |
---|
116 | 'physics': 'Physics', |
---|
117 | 'physics_alt_syl': 'Physics (Alt.Syl)', |
---|
118 | 'principles_and_practice_of_education': 'Principles and Practice of Education', |
---|
119 | 'principles_of_cost_accounting': 'Principles of Cost Accounting', |
---|
120 | 'rural_science': 'Rural Science', |
---|
121 | 'science': 'Science', |
---|
122 | 'secretarial_duties': 'Secretarial Duties', |
---|
123 | 'shorthand': 'Shorthand', |
---|
124 | 'sierra_leone_studies': 'Sierra Leone Studies', |
---|
125 | 'sierra_leone_languages': 'Sierra Leone Languages', |
---|
126 | 'social_studies': 'Social Studies', |
---|
127 | 'statistics': 'Statistics', |
---|
128 | 'teaching_practice': 'Teaching Practice', |
---|
129 | 'technical_drawing': 'Technical Drawing', |
---|
130 | 'typewriting': 'Typewriting', |
---|
131 | 'visual_art': 'Visual Art', |
---|
132 | 'woodwork': 'Woodwork', |
---|
133 | 'winding_elect_machines': 'Winding of Elect Machines and Elect Eng Sc' |
---|
134 | } |
---|
135 | |
---|
136 | EXAM_GRADES = ( |
---|
137 | ('A1', 'Excellent (A1)'), |
---|
138 | ('A2', 'Very Good (A2)'), |
---|
139 | ('A3', 'Good (A3)'), |
---|
140 | ('B2', 'Very Good (B2)'), |
---|
141 | ('B3', 'Good (B3)'), |
---|
142 | ('C4', 'Credit (C4)'), |
---|
143 | ('C5', 'Credit (C5)'), |
---|
144 | ('C6', 'Credit (C6)'), |
---|
145 | ('A', 'Pass (A)'), |
---|
146 | ('B', 'Pass (B)'), |
---|
147 | ('C', 'Pass (C)'), |
---|
148 | ('U', 'Pass (U)'), |
---|
149 | ('D7', 'Pass (D7)'), |
---|
150 | ('P7', 'Pass (P7)'), |
---|
151 | ('P8', 'Pass (P8)'), |
---|
152 | ('E8', 'Pass (E8)'), |
---|
153 | ('F9', 'Fail (F9)'), |
---|
154 | ('Aa', 'A (a)'), |
---|
155 | ('Bb', 'B (b)'), |
---|
156 | ('Cc', 'C (c)'), |
---|
157 | ('Dd', 'D (d)'), |
---|
158 | ('Ee', 'E (e)'), |
---|
159 | ('Ff', 'F (f)'), |
---|
160 | ('Gg', 'G (g)') |
---|
161 | ) |
---|
162 | |
---|
163 | INST_TYPES_DICT = { |
---|
164 | 'none': '', |
---|
165 | 'faculty': 'Faculty of', |
---|
166 | 'department': 'Department of', |
---|
167 | 'school': 'School of', |
---|
168 | 'office': 'Office for', |
---|
169 | 'centre': 'Centre for', |
---|
170 | 'institute': 'Institute of', |
---|
171 | 'school_for': 'School for', |
---|
172 | 'college': 'College of', |
---|
173 | } |
---|
174 | |
---|
175 | STUDY_MODES_DICT = { |
---|
176 | 'rmd_ft': 'Remedial with deficiencies', |
---|
177 | 'dp_pt': 'Diploma Part Time', |
---|
178 | 'ct_ft': 'Certificate Full Time', |
---|
179 | 'dp_ft': 'Diploma Full Time', |
---|
180 | 'de_pt': 'Direct Entry Part Time', |
---|
181 | 'pg_ft': 'Postgraduate Full Time', |
---|
182 | 'pg_pt': 'Postgraduate Part Time', |
---|
183 | 'jm_ft': 'Joint Matriculation Full Time', |
---|
184 | 'ume_ft': 'UME Full Time', |
---|
185 | 'de_ft': 'Direct Entry Full Time', |
---|
186 | 'ph_ft': 'Post Higher Education Full Time', |
---|
187 | 'transfer_pt': 'Transfer Part Time', |
---|
188 | 'ug_pt': 'Undergraduate Part Time', |
---|
189 | 'transfer_ft': 'Transfer Full Time', |
---|
190 | 'ct_pt': 'Certificate Part Time', |
---|
191 | 'ug_ft': 'Undergraduate Full Time', |
---|
192 | 'rm_ft': 'Remedial' |
---|
193 | } |
---|
194 | |
---|
195 | APP_CATS_DICT = { |
---|
196 | 'basic': 'PUME, PDE, PCE, PRENCE', |
---|
197 | 'no': 'no application', |
---|
198 | 'pg_ft': 'Postgraduate Full-Time', |
---|
199 | 'pg_pt': 'Postgraduate Part-Time', |
---|
200 | 'sandwich': 'Sandwich', |
---|
201 | 'cest': 'Part-Time, Diploma, Certificate' |
---|
202 | } |
---|
203 | |
---|
204 | @property |
---|
205 | def tzinfo(self): |
---|
206 | return pytz.timezone('Africa/Lagos') |
---|