1 | ## $Id: utils.py 12551 2015-02-02 10:21:08Z 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 | 'food_and_nutrition': 'Food and Nutrition', |
---|
91 | 'french': 'French', |
---|
92 | 'further_mathematics': 'Further Mathematics', |
---|
93 | 'general_science': 'General Science', |
---|
94 | 'geography': 'Geography', |
---|
95 | 'german': 'German', |
---|
96 | 'government': 'Government', |
---|
97 | 'hausa': 'Hausa', |
---|
98 | 'hausa_literature': 'Hausa Literature', |
---|
99 | 'health_science': 'Health Science', |
---|
100 | 'history': 'History', |
---|
101 | 'home_management': 'Home Management', |
---|
102 | 'human_biology': 'Human Biology', |
---|
103 | 'industrial_electrical_installation': 'Industrial Elect Installation (Adv)', |
---|
104 | 'intergrated_science': 'Intergrated Science', |
---|
105 | 'islamic_studies': 'Islamic Studies', |
---|
106 | 'literature_in_english': 'Literature in English', |
---|
107 | 'literature_in_nigerian_languages': 'Literature in Nigerian Languages', |
---|
108 | 'igbo': 'Igbo', |
---|
109 | 'igbo_literature': 'Igbo Literature', |
---|
110 | 'yoruba': 'Yoruba', |
---|
111 | 'yoruba_literature': 'Yoruba Literature', |
---|
112 | 'management_in_living': 'Management in Living', |
---|
113 | 'mathematics': 'Mathematics', |
---|
114 | 'metalwork': 'Metalwork', |
---|
115 | 'music': 'Music', |
---|
116 | 'nigerian_language': 'Nigerian Language', |
---|
117 | 'office_practice': 'Office Practice', |
---|
118 | 'physical_education': 'Physical Education', |
---|
119 | 'physical_health_education': 'Physical and Health Education', |
---|
120 | 'physics': 'Physics', |
---|
121 | 'physics_alt_syl': 'Physics (Alt.Syl)', |
---|
122 | 'principles_and_practice_of_education': 'Principles and Practice of Education', |
---|
123 | 'principles_of_cost_accounting': 'Principles of Cost Accounting', |
---|
124 | 'rural_science': 'Rural Science', |
---|
125 | 'science': 'Science', |
---|
126 | 'secretarial_duties': 'Secretarial Duties', |
---|
127 | 'shorthand': 'Shorthand', |
---|
128 | 'sierra_leone_studies': 'Sierra Leone Studies', |
---|
129 | 'sierra_leone_languages': 'Sierra Leone Languages', |
---|
130 | 'social_studies': 'Social Studies', |
---|
131 | 'statistics': 'Statistics', |
---|
132 | 'teaching_practice': 'Teaching Practice', |
---|
133 | 'technical_drawing': 'Technical Drawing', |
---|
134 | 'typewriting': 'Typewriting', |
---|
135 | 'visual_art': 'Visual Art', |
---|
136 | 'woodwork': 'Woodwork', |
---|
137 | 'winding_elect_machines': 'Winding of Elect Machines and Elect Eng Sc', |
---|
138 | 'first_written': 'First Written', |
---|
139 | 'second_written': 'Second Written', |
---|
140 | 'pract_tests': 'Practical Tests', |
---|
141 | # Added 25/08/2014 |
---|
142 | 'animal_husbandry_(alt_a)': 'Animal Husbandry (Alt A)', |
---|
143 | 'animal_husbandry_(alt_b)': 'Animal Husbandry (Alt B)', |
---|
144 | 'auto_electrical_work': 'Auto Electrical Work', |
---|
145 | 'auto_mechanical_work': 'Auto Mechanical Work', |
---|
146 | 'catering_craft_practice': 'Catering Craft Practice', |
---|
147 | 'civic_education': 'Civic Education', |
---|
148 | 'computer_studies': 'Computer Studies', |
---|
149 | 'cosmetology': 'Cosmetology', |
---|
150 | 'data_processing': 'Data Processing', |
---|
151 | 'dyeing_&_bleaching': 'Dyeing & Bleaching', |
---|
152 | 'electrical_installation_and_maintenance_work': 'Electrical Installation and Maintenance Work', |
---|
153 | 'fisheries_(alt_a)_ghana_candidates': 'Fisheries (Alt A) Ghana Candidates', |
---|
154 | 'fisheries_(alt_b)_nigeria_candidates': 'Fisheries (Alt B) Nigeria Candidates', |
---|
155 | 'garment_making': 'Garment Making', |
---|
156 | 'general_agriculture': 'General Agriculture', |
---|
157 | 'gsm_phones_maintenance_and_repairs': 'Gsm Phones Maintenance and Repairs', |
---|
158 | 'health_education': 'Health Education', |
---|
159 | 'insurance': 'Insurance', |
---|
160 | 'painting_and_decorating': 'Painting and Decorating', |
---|
161 | 'photography': 'Photography', |
---|
162 | 'printing_craft_practice': 'Printing Craft Practice', |
---|
163 | 'store_management': 'Store Management', |
---|
164 | 'textiles': 'Textiles', |
---|
165 | # Added 19/01/2015 |
---|
166 | 'marketing': 'Marketing', |
---|
167 | 'carpentry_joinery': 'Carpentry and Joinery', |
---|
168 | 'tourism': 'Tourism', |
---|
169 | 'mining': 'Mining', |
---|
170 | } |
---|
171 | |
---|
172 | EXAM_GRADES = ( |
---|
173 | ('A1', 'Excellent (A1)'), |
---|
174 | ('A2', 'Very Good (A2)'), |
---|
175 | ('A3', 'Good (A3)'), |
---|
176 | ('B2', 'Very Good (B2)'), |
---|
177 | ('B3', 'Good (B3)'), |
---|
178 | ('C4', 'Credit (C4)'), |
---|
179 | ('C5', 'Credit (C5)'), |
---|
180 | ('C6', 'Credit (C6)'), |
---|
181 | ('A', 'Pass (A)'), |
---|
182 | ('B', 'Pass (B)'), |
---|
183 | ('C', 'Pass (C)'), |
---|
184 | ('U', 'Pass (U)'), |
---|
185 | ('D7', 'Pass (D7)'), |
---|
186 | ('P7', 'Pass (P7)'), |
---|
187 | ('P8', 'Pass (P8)'), |
---|
188 | ('E8', 'Pass (E8)'), |
---|
189 | ('F9', 'Fail (F9)'), |
---|
190 | ('Aa', 'A (a)'), |
---|
191 | ('Bb', 'B (b)'), |
---|
192 | ('Cc', 'C (c)'), |
---|
193 | ('Dd', 'D (d)'), |
---|
194 | ('Ee', 'E (e)'), |
---|
195 | ('Ff', 'F (f)'), |
---|
196 | ('Gg', 'G (g)'), |
---|
197 | ('credit-1', 'Credit-1'), |
---|
198 | ('credit-2', 'Credit-2'), |
---|
199 | ('dist', 'Distinction'), |
---|
200 | ('pass', 'Pass'), |
---|
201 | ('AR', 'Awaiting Results'), |
---|
202 | ) |
---|
203 | |
---|
204 | INST_TYPES_DICT = { |
---|
205 | 'none': '', |
---|
206 | 'faculty': 'Faculty of', |
---|
207 | 'department': 'Department of', |
---|
208 | 'school': 'School of', |
---|
209 | 'office': 'Office for', |
---|
210 | 'centre': 'Centre for', |
---|
211 | 'institute': 'Institute of', |
---|
212 | 'school_for': 'School for', |
---|
213 | 'college': 'College of', |
---|
214 | 'directorate': 'Directorate of', |
---|
215 | } |
---|
216 | |
---|
217 | STUDY_MODES_DICT = { |
---|
218 | 'ume_ft': 'UME Full Time', |
---|
219 | 'ug_ft': 'Undergraduate Full Time', |
---|
220 | 'ug_pt': 'Undergraduate Part Time', |
---|
221 | 'dp_pt': 'Diploma Part Time', |
---|
222 | 'ct_ft': 'Certificate Full Time', |
---|
223 | 'dp_ft': 'Diploma Full Time', |
---|
224 | 'de_ft': 'Direct Entry Full Time', |
---|
225 | 'de_pt': 'Direct Entry Part Time', |
---|
226 | 'nd_ft': 'National Diploma Full Time', |
---|
227 | 'nd_pt': 'National Diploma Part Time', |
---|
228 | 'hnd_ft': 'Higher National Diploma Full Time', |
---|
229 | 'hnd_pt': 'Higher National Diploma Part Time', |
---|
230 | 'pg_ft': 'Postgraduate Full Time', |
---|
231 | 'pg_pt': 'Postgraduate Part Time', |
---|
232 | 'pgd_ft': 'Postgraduate Diploma Full Time', |
---|
233 | 'pgd_pt': 'Postgraduate Diploma Part Time', |
---|
234 | 'special_pg_pt': 'Special Postgraduate Part Time', |
---|
235 | 'nce_ft': 'NCE Full Time', |
---|
236 | 'nce_pt': 'NCE Part Time', |
---|
237 | 'ug_sw': 'Undergraduate Sandwich', |
---|
238 | 'nce_sw': 'NCE Sandwich', |
---|
239 | 'jm_ft': 'Joint Matriculation Full Time', |
---|
240 | 'ph_ft': 'Post Higher Education Full Time', |
---|
241 | 'transfer_pt': 'Transfer Part Time', |
---|
242 | 'transfer_ft': 'Transfer Full Time', |
---|
243 | 'ct_pt': 'Certificate Part Time', |
---|
244 | 'rmd_ft': 'Remedial with deficiencies', |
---|
245 | 'rm_ft': 'Remedial', |
---|
246 | 'transfer': 'Transfer', |
---|
247 | 'prence': 'Pre-NCE', |
---|
248 | 'prend': 'Pre-ND', |
---|
249 | 'pce': 'PCE', |
---|
250 | 'pd_ft': 'Professional Diploma in Education', |
---|
251 | 'found': 'Foundation', |
---|
252 | 'no': 'no application', |
---|
253 | } |
---|
254 | |
---|
255 | APP_CATS_DICT = { |
---|
256 | 'basic': 'PUTME, PUDE, PCE, PRENCE', |
---|
257 | 'no': 'No Application', |
---|
258 | 'pg_ft': 'Postgraduate Full-Time', |
---|
259 | 'pg_pt': 'Postgraduate Part-Time', |
---|
260 | 'sandwich': 'Sandwich', |
---|
261 | 'cest': 'Part-Time, Diploma, Certificate', |
---|
262 | } |
---|
263 | |
---|
264 | @property |
---|
265 | def tzinfo(self): |
---|
266 | return pytz.timezone('Africa/Lagos') |
---|