1 | ## $Id: utils.py 13343 2015-10-21 15:48:22Z 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 kofacustom.nigeria.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 NigeriaKofaUtils(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 | 'ha':(4, u'Hausa'), |
---|
46 | 'yo':(5, u'Yoruba'), |
---|
47 | 'ig':(6, u'Igbo'), |
---|
48 | } |
---|
49 | |
---|
50 | #: A function to return |
---|
51 | @classmethod |
---|
52 | def sorted_phone_prefixes(cls, data=INT_PHONE_PREFIXES, request=None): |
---|
53 | return sorted_phone_prefixes(data, request) |
---|
54 | |
---|
55 | EXAM_SUBJECTS_DICT = { |
---|
56 | 'accounts': 'Accounts', |
---|
57 | 'add_general_science': 'Add General Science', |
---|
58 | 'add_maths': 'Add Maths', |
---|
59 | 'adv_elect_install_maint': 'Adv. Electrical Installation and Maintenance', |
---|
60 | 'agricultural_science': 'Agricultural Science', |
---|
61 | 'applied_electricity': 'Applied Electricity', |
---|
62 | 'arabi': 'Arabic', |
---|
63 | 'arithmetics': 'Arithmetics', |
---|
64 | 'art': 'Art', |
---|
65 | 'auto_mechanics': 'Auto Mechanics', |
---|
66 | 'awaiting_results': 'Awaiting Results', |
---|
67 | 'basic_electricity': 'Basic Electricity', |
---|
68 | 'bible_knowledge': 'Bible Knowledge', |
---|
69 | 'biology': 'Biology', |
---|
70 | 'biology_alt_syl': 'Biology (Alt.Syl)', |
---|
71 | 'book_keeping': 'Book Keeping', |
---|
72 | 'building_construction': 'Building Construction', |
---|
73 | 'business_management': 'Business Management', |
---|
74 | 'business_construction_management': 'Business/Construction Management (Adv)', |
---|
75 | 'chemistry': 'Chemistry', |
---|
76 | 'chemistry_alt_syl': 'Chemistry (Alt.Syl)', |
---|
77 | 'christian_religious_studies': 'Christian Religious Studies', |
---|
78 | 'class_teaching': 'Class Teaching', |
---|
79 | 'clerical_office_duties': 'Clerical Office Duties', |
---|
80 | 'clothing_and_textiles': 'Clothing and Textiles', |
---|
81 | 'commerce': 'Commerce', |
---|
82 | 'economics': 'Economics', |
---|
83 | 'education': 'Education', |
---|
84 | 'efik': 'Efik', |
---|
85 | 'electronics': 'Electronics', |
---|
86 | 'elementary_surveying': 'Elementary Surveying', |
---|
87 | 'english_language': 'English Language', |
---|
88 | 'engineering_science': 'Engineering Science', |
---|
89 | 'financial_accounting': 'Financial Accounting', |
---|
90 | 'fine_art': 'Fine Art', |
---|
91 | 'food_and_nutrition': 'Food and Nutrition', |
---|
92 | 'french': 'French', |
---|
93 | 'further_mathematics': 'Further Mathematics', |
---|
94 | 'general_science': 'General Science', |
---|
95 | 'geography': 'Geography', |
---|
96 | 'german': 'German', |
---|
97 | 'government': 'Government', |
---|
98 | 'hausa': 'Hausa', |
---|
99 | 'hausa_literature': 'Hausa Literature', |
---|
100 | 'health_science': 'Health Science', |
---|
101 | 'history': 'History', |
---|
102 | 'home_economics': 'Home Economics', |
---|
103 | 'home_management': 'Home Management', |
---|
104 | 'human_biology': 'Human Biology', |
---|
105 | 'industrial_electrical_installation': 'Industrial Elect Installation (Adv)', |
---|
106 | 'intergrated_science': 'Intergrated Science', |
---|
107 | 'islamic_studies': 'Islamic Studies', |
---|
108 | 'literature_in_english': 'Literature in English', |
---|
109 | 'literature_in_nigerian_languages': 'Literature in Nigerian Languages', |
---|
110 | 'igbo': 'Igbo', |
---|
111 | 'igbo_literature': 'Igbo Literature', |
---|
112 | 'yoruba': 'Yoruba', |
---|
113 | 'yoruba_literature': 'Yoruba Literature', |
---|
114 | 'management_in_living': 'Management in Living', |
---|
115 | 'mathematics': 'Mathematics', |
---|
116 | 'metalwork': 'Metalwork', |
---|
117 | 'music': 'Music', |
---|
118 | 'nigerian_language': 'Nigerian Language', |
---|
119 | 'office_practice': 'Office Practice', |
---|
120 | 'physical_education': 'Physical Education', |
---|
121 | 'physical_health_education': 'Physical and Health Education', |
---|
122 | 'physics': 'Physics', |
---|
123 | 'physics_alt_syl': 'Physics (Alt.Syl)', |
---|
124 | 'principles_and_practice_of_education': 'Principles and Practice of Education', |
---|
125 | 'principles_of_cost_accounting': 'Principles of Cost Accounting', |
---|
126 | 'rural_science': 'Rural Science', |
---|
127 | 'science': 'Science', |
---|
128 | 'secretarial_duties': 'Secretarial Duties', |
---|
129 | 'shorthand': 'Shorthand', |
---|
130 | 'sierra_leone_studies': 'Sierra Leone Studies', |
---|
131 | 'sierra_leone_languages': 'Sierra Leone Languages', |
---|
132 | 'social_studies': 'Social Studies', |
---|
133 | 'statistics': 'Statistics', |
---|
134 | 'teaching_practice': 'Teaching Practice', |
---|
135 | 'technical_drawing': 'Technical Drawing', |
---|
136 | 'typewriting': 'Typewriting', |
---|
137 | 'visual_art': 'Visual Art', |
---|
138 | 'woodwork': 'Woodwork', |
---|
139 | 'winding_elect_machines': 'Winding of Elect Machines and Elect Eng Sc', |
---|
140 | 'first_written': 'First Written', |
---|
141 | 'second_written': 'Second Written', |
---|
142 | 'pract_tests': 'Practical Tests', |
---|
143 | # Added 25/08/2014 |
---|
144 | 'animal_husbandry_(alt_a)': 'Animal Husbandry (Alt A)', |
---|
145 | 'animal_husbandry_(alt_b)': 'Animal Husbandry (Alt B)', |
---|
146 | 'auto_electrical_work': 'Auto Electrical Work', |
---|
147 | 'auto_mechanical_work': 'Auto Mechanical Work', |
---|
148 | 'catering_craft_practice': 'Catering Craft Practice', |
---|
149 | 'civic_education': 'Civic Education', |
---|
150 | 'computer_studies': 'Computer Studies', |
---|
151 | 'cosmetology': 'Cosmetology', |
---|
152 | 'data_processing': 'Data Processing', |
---|
153 | 'dyeing_&_bleaching': 'Dyeing & Bleaching', |
---|
154 | 'electrical_installation_and_maintenance_work': 'Electrical Installation and Maintenance Work', |
---|
155 | 'fisheries_(alt_a)_ghana_candidates': 'Fisheries (Alt A) Ghana Candidates', |
---|
156 | 'fisheries_(alt_b)_nigeria_candidates': 'Fisheries (Alt B) Nigeria Candidates', |
---|
157 | 'garment_making': 'Garment Making', |
---|
158 | 'general_agriculture': 'General Agriculture', |
---|
159 | 'gsm_phones_maintenance_and_repairs': 'Gsm Phones Maintenance and Repairs', |
---|
160 | 'health_education': 'Health Education', |
---|
161 | 'insurance': 'Insurance', |
---|
162 | 'painting_and_decorating': 'Painting and Decorating', |
---|
163 | 'photography': 'Photography', |
---|
164 | 'printing_craft_practice': 'Printing Craft Practice', |
---|
165 | 'store_management': 'Store Management', |
---|
166 | 'textiles': 'Textiles', |
---|
167 | # Added after 19/01/2015 |
---|
168 | 'marketing': 'Marketing', |
---|
169 | 'carpentry_joinery': 'Carpentry and Joinery', |
---|
170 | 'tourism': 'Tourism', |
---|
171 | 'mining': 'Mining', |
---|
172 | 'furniture_making': 'Furniture Making', |
---|
173 | 'information_communication_technology': 'Information and Communication Technology', |
---|
174 | } |
---|
175 | |
---|
176 | EXAM_GRADES = ( |
---|
177 | ('A1', 'Excellent (A1)'), |
---|
178 | ('A2', 'Very Good (A2)'), |
---|
179 | ('A3', 'Good (A3)'), |
---|
180 | ('B2', 'Very Good (B2)'), |
---|
181 | ('B3', 'Good (B3)'), |
---|
182 | ('C4', 'Credit (C4)'), |
---|
183 | ('C5', 'Credit (C5)'), |
---|
184 | ('C6', 'Credit (C6)'), |
---|
185 | ('A', 'Pass (A)'), |
---|
186 | ('B', 'Pass (B)'), |
---|
187 | ('C', 'Pass (C)'), |
---|
188 | ('U', 'Pass (U)'), |
---|
189 | ('D7', 'Pass (D7)'), |
---|
190 | ('P7', 'Pass (P7)'), |
---|
191 | ('P8', 'Pass (P8)'), |
---|
192 | ('E8', 'Pass (E8)'), |
---|
193 | ('F9', 'Fail (F9)'), |
---|
194 | ('Aa', 'A (a)'), |
---|
195 | ('Bb', 'B (b)'), |
---|
196 | ('Cc', 'C (c)'), |
---|
197 | ('Dd', 'D (d)'), |
---|
198 | ('Ee', 'E (e)'), |
---|
199 | ('Ff', 'F (f)'), |
---|
200 | ('Gg', 'G (g)'), |
---|
201 | ('credit-1', 'Credit-1'), |
---|
202 | ('credit-2', 'Credit-2'), |
---|
203 | ('dist', 'Distinction'), |
---|
204 | ('pass', 'Pass'), |
---|
205 | ('AR', 'Awaiting Results'), |
---|
206 | ) |
---|
207 | |
---|
208 | INST_TYPES_DICT = { |
---|
209 | 'none': '', |
---|
210 | 'faculty': 'Faculty of', |
---|
211 | 'department': 'Department of', |
---|
212 | 'school': 'School of', |
---|
213 | 'office': 'Office for', |
---|
214 | 'centre': 'Centre for', |
---|
215 | 'institute': 'Institute of', |
---|
216 | 'school_for': 'School for', |
---|
217 | 'college': 'College of', |
---|
218 | 'directorate': 'Directorate of', |
---|
219 | } |
---|
220 | |
---|
221 | STUDY_MODES_DICT = { |
---|
222 | 'ume_ft': 'UME Full Time', |
---|
223 | 'ug_ft': 'Undergraduate Full Time', |
---|
224 | 'ug_pt': 'Undergraduate Part Time', |
---|
225 | 'dp_pt': 'Diploma Part Time', |
---|
226 | 'ct_ft': 'Certificate Full Time', |
---|
227 | 'dp_ft': 'Diploma Full Time', |
---|
228 | 'de_ft': 'Direct Entry Full Time', |
---|
229 | 'de_pt': 'Direct Entry Part Time', |
---|
230 | 'nd_ft': 'National Diploma Full Time', |
---|
231 | 'nd_pt': 'National Diploma Part Time', |
---|
232 | 'hnd_ft': 'Higher National Diploma Full Time', |
---|
233 | 'hnd_pt': 'Higher National Diploma Part Time', |
---|
234 | 'pg_ft': 'Postgraduate Full Time', |
---|
235 | 'pg_pt': 'Postgraduate Part Time', |
---|
236 | 'pgd_ft': 'Postgraduate Diploma Full Time', |
---|
237 | 'pgd_pt': 'Postgraduate Diploma Part Time', |
---|
238 | 'special_pg_pt': 'Special Postgraduate Part Time', |
---|
239 | 'nce_ft': 'NCE Full Time', |
---|
240 | 'nce_pt': 'NCE Part Time', |
---|
241 | 'ug_sw': 'Undergraduate Sandwich', |
---|
242 | 'nce_sw': 'NCE Sandwich', |
---|
243 | 'jm_ft': 'Joint Matriculation Full Time', |
---|
244 | 'ph_ft': 'Post Higher Education Full Time', |
---|
245 | 'transfer_pt': 'Transfer Part Time', |
---|
246 | 'transfer_ft': 'Transfer Full Time', |
---|
247 | 'ct_pt': 'Certificate Part Time', |
---|
248 | 'rmd_ft': 'Remedial with deficiencies', |
---|
249 | 'rm_ft': 'Remedial', |
---|
250 | 'transfer': 'Transfer', |
---|
251 | 'prence': 'Pre-NCE', |
---|
252 | 'prend': 'Pre-ND', |
---|
253 | 'pce': 'PCE', |
---|
254 | 'pd_ft': 'Professional Diploma in Education', |
---|
255 | 'found': 'Foundation', |
---|
256 | 'no': 'no application', |
---|
257 | } |
---|
258 | |
---|
259 | APP_CATS_DICT = { |
---|
260 | 'basic': 'PUTME, PUDE, PCE, PRENCE', |
---|
261 | 'no': 'No Application', |
---|
262 | 'pg_ft': 'Postgraduate Full-Time', |
---|
263 | 'pg_pt': 'Postgraduate Part-Time', |
---|
264 | 'sandwich': 'Sandwich', |
---|
265 | 'cest': 'Part-Time, Diploma, Certificate', |
---|
266 | 'pre': 'Pre-Degree Studies', |
---|
267 | } |
---|
268 | |
---|
269 | VERDICTS_DICT = { |
---|
270 | '0': 'not yet', |
---|
271 | 'A': 'Successful student', |
---|
272 | 'B': 'Student with carryover courses', |
---|
273 | 'C': 'Student on probation', |
---|
274 | 'D': 'Withdrawn from the faculty', |
---|
275 | 'E': 'Student who were previously on probation', |
---|
276 | 'F': 'Medical case', |
---|
277 | 'G': 'Absent from examination', |
---|
278 | 'H': 'Withheld results', |
---|
279 | 'I': 'Expelled/rusticated/suspended student', |
---|
280 | 'J': 'Temporary withdrawn from the university', |
---|
281 | 'K': 'Unregistered student', |
---|
282 | 'L': 'Referred student', |
---|
283 | 'M': 'Reinstatement', |
---|
284 | 'N': 'Student on transfer', |
---|
285 | #'O': 'NCE-III repeater', # FCEOkene only |
---|
286 | 'P': 'Exhausted maximum years in the university', |
---|
287 | 'Y': 'No previous verdict', |
---|
288 | 'X': 'New 300 level student (Uniben)', |
---|
289 | 'Z': 'Successful student (provisional)', |
---|
290 | 'A1': 'First Class', |
---|
291 | 'A2': 'Second Class Upper', |
---|
292 | 'A3': 'Second Class Lower', |
---|
293 | 'A4': 'Third Class', |
---|
294 | 'A5': 'Pass', |
---|
295 | 'A6': 'Distinction', |
---|
296 | 'A7': 'Credit', |
---|
297 | 'A8': 'Merit', |
---|
298 | } |
---|
299 | |
---|
300 | |
---|
301 | @property |
---|
302 | def tzinfo(self): |
---|
303 | return pytz.timezone('Africa/Lagos') |
---|