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