1 | ## $Id: utils.py 8567 2012-05-30 20:37:57Z 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 | } |
---|
43 | |
---|
44 | #: A function to return |
---|
45 | @classmethod |
---|
46 | def sorted_phone_prefixes(cls, data=INT_PHONE_PREFIXES, request=None): |
---|
47 | return sorted_phone_prefixes(data, request) |
---|
48 | |
---|
49 | EXAM_SUBJECTS_DICT = { |
---|
50 | 'accounts': 'Accounts', |
---|
51 | 'add_general_science': 'Add General Science', |
---|
52 | 'add_maths': 'Add Maths', |
---|
53 | 'adv_elect_install_maint': 'Adv. Electrical Installation and Maintenance', |
---|
54 | 'agricultural_science': 'Agricultural Science', |
---|
55 | 'applied_electricity': 'Applied Electricity', |
---|
56 | 'arabi': 'Arabic', |
---|
57 | 'arithmetics': 'Arithmetics', |
---|
58 | 'art': 'Art', |
---|
59 | 'auto_mechanics': 'Auto Mechanics', |
---|
60 | 'basic_electricity': 'Basic Electricity', |
---|
61 | 'bible_knowledge': 'Bible Knowledge', |
---|
62 | 'biology': 'Biology', |
---|
63 | 'biology_alt_syl': 'Biology (Alt.Syl)', |
---|
64 | 'book_keeping': 'Book Keeping', |
---|
65 | 'building_construction': 'Building Construction', |
---|
66 | 'business_management': 'Business Management', |
---|
67 | 'business_construction_management': 'Business/Construction Management (Adv)', |
---|
68 | 'chemistry': 'Chemistry', |
---|
69 | 'chemistry_alt_syl': 'Chemistry (Alt.Syl)', |
---|
70 | 'christian_religious_studies': 'Christian Religious Studies', |
---|
71 | 'class_teaching': 'Class Teaching', |
---|
72 | 'clerical_office_duties': 'Clerical Office Duties', |
---|
73 | 'clothing_and_textiles': 'Clothing and Textiles', |
---|
74 | 'commerce': 'Commerce', |
---|
75 | 'economics': 'Economics', |
---|
76 | 'education': 'Education', |
---|
77 | 'efik': 'Efik', |
---|
78 | 'electronics': 'Electronics', |
---|
79 | 'elementary_surveying': 'Elementary Surveying', |
---|
80 | 'english_language': 'English Language', |
---|
81 | 'engineering_science': 'Engineering Science', |
---|
82 | 'financial_accounting': 'Financial Accounting', |
---|
83 | 'food_and_nutrition': 'Food and Nutrition', |
---|
84 | 'french': 'French', |
---|
85 | 'further_mathematics': 'Further Mathematics', |
---|
86 | 'general_science': 'General Science', |
---|
87 | 'geography': 'Geography', |
---|
88 | 'german': 'German', |
---|
89 | 'government': 'Government', |
---|
90 | 'hausa': 'Hausa', |
---|
91 | 'hausa_literature': 'Hausa Literature', |
---|
92 | 'health_science': 'Health Science', |
---|
93 | 'history': 'History', |
---|
94 | 'home_management': 'Home Management', |
---|
95 | 'human_biology': 'Human Biology', |
---|
96 | 'industrial_electrical_installation': 'Industrial Elect Installation (Adv)', |
---|
97 | 'intergrated_science': 'Intergrated Science', |
---|
98 | 'islamic_studies': 'Islamic Studies', |
---|
99 | 'literature_in_english': 'Literature in English', |
---|
100 | 'literature_in_nigerian_languages': 'Literature in Nigerian Languages', |
---|
101 | 'igbo': 'Igbo', |
---|
102 | 'igbo_literature': 'Igbo Literature', |
---|
103 | 'yoruba': 'Yoruba', |
---|
104 | 'yoruba_literature': 'Yoruba Literature', |
---|
105 | 'management_in_living': 'Management in Living', |
---|
106 | 'mathematics': 'Mathematics', |
---|
107 | 'metalwork': 'Metalwork', |
---|
108 | 'music': 'Music', |
---|
109 | 'nigerian_language': 'Nigerian Language', |
---|
110 | 'office_practice': 'Office Practice', |
---|
111 | 'physical_education': 'Physical Education', |
---|
112 | 'physical_health_education': 'Physical and Health Education', |
---|
113 | 'physics': 'Physics', |
---|
114 | 'physics_alt_syl': 'Physics (Alt.Syl)', |
---|
115 | 'principles_and_practice_of_education': 'Principles and Practice of Education', |
---|
116 | 'principles_of_cost_accounting': 'Principles of Cost Accounting', |
---|
117 | 'rural_science': 'Rural Science', |
---|
118 | 'science': 'Science', |
---|
119 | 'secretarial_duties': 'Secretarial Duties', |
---|
120 | 'shorthand': 'Shorthand', |
---|
121 | 'sierra_leone_studies': 'Sierra Leone Studies', |
---|
122 | 'sierra_leone_languages': 'Sierra Leone Languages', |
---|
123 | 'social_studies': 'Social Studies', |
---|
124 | 'statistics': 'Statistics', |
---|
125 | 'teaching_practice': 'Teaching Practice', |
---|
126 | 'technical_drawing': 'Technical Drawing', |
---|
127 | 'typewriting': 'Typewriting', |
---|
128 | 'visual_art': 'Visual Art', |
---|
129 | 'woodwork': 'Woodwork', |
---|
130 | 'winding_elect_machines': 'Winding of Elect Machines and Elect Eng Sc' |
---|
131 | } |
---|
132 | |
---|
133 | EXAM_GRADES = ( |
---|
134 | ('A1', 'Excellent (A1)'), |
---|
135 | ('A2', 'Very Good (A2)'), |
---|
136 | ('A3', 'Good (A3)'), |
---|
137 | ('B2', 'Very Good (B2)'), |
---|
138 | ('B3', 'Good (B3)'), |
---|
139 | ('C4', 'Credit (C4)'), |
---|
140 | ('C5', 'Credit (C5)'), |
---|
141 | ('C6', 'Credit (C6)'), |
---|
142 | ('A', 'Pass (A)'), |
---|
143 | ('B', 'Pass (B)'), |
---|
144 | ('C', 'Pass (C)'), |
---|
145 | ('U', 'Pass (U)'), |
---|
146 | ('D7', 'Pass (D7)'), |
---|
147 | ('P7', 'Pass (P7)'), |
---|
148 | ('P8', 'Pass (P8)'), |
---|
149 | ('E8', 'Pass (E8)'), |
---|
150 | ('F9', 'Fail (F9)'), |
---|
151 | ('Aa', 'A (a)'), |
---|
152 | ('Bb', 'B (b)'), |
---|
153 | ('Cc', 'C (c)'), |
---|
154 | ('Dd', 'D (d)'), |
---|
155 | ('Ee', 'E (e)'), |
---|
156 | ('Ff', 'F (f)'), |
---|
157 | ('Gg', 'G (g)') |
---|
158 | ) |
---|
159 | |
---|
160 | INST_TYPES_DICT = { |
---|
161 | 'none': '', |
---|
162 | 'faculty': 'Faculty of', |
---|
163 | 'department': 'Department of', |
---|
164 | 'school': 'School of', |
---|
165 | 'office': 'Office for', |
---|
166 | 'centre': 'Centre for', |
---|
167 | 'institute': 'Institute of', |
---|
168 | 'school_for': 'School for', |
---|
169 | 'college': 'College of', |
---|
170 | } |
---|
171 | |
---|
172 | STUDY_MODES_DICT = { |
---|
173 | 'rmd_ft': 'Remedial with deficiencies', |
---|
174 | 'dp_pt': 'Diploma Part Time', |
---|
175 | 'ct_ft': 'Certificate Full Time', |
---|
176 | 'dp_ft': 'Diploma Full Time', |
---|
177 | 'de_pt': 'Direct Entry Part Time', |
---|
178 | 'pg_ft': 'Postgraduate Full Time', |
---|
179 | 'pg_pt': 'Postgraduate Part Time', |
---|
180 | 'jm_ft': 'Joint Matriculation Full Time', |
---|
181 | 'de_ft': 'Direct Entry Full Time', |
---|
182 | 'ph_ft': 'Post Higher Education Full Time', |
---|
183 | 'transfer_pt': 'Transfer Part Time', |
---|
184 | 'ug_pt': 'Undergraduate Part Time', |
---|
185 | 'transfer_ft': 'Transfer Full Time', |
---|
186 | 'ct_pt': 'Certificate Part Time', |
---|
187 | 'ug_ft': 'Undergraduate Full Time', |
---|
188 | 'rm_ft': 'Remedial' |
---|
189 | } |
---|
190 | |
---|
191 | APP_CATS_DICT = { |
---|
192 | 'basic': 'PUTME, PDE, PCE, PRENCE', |
---|
193 | 'no': 'no application', |
---|
194 | 'pg_ft': 'Postgraduate Full-Time', |
---|
195 | 'pg_pt': 'Postgraduate Part-Time', |
---|
196 | 'sandwich': 'Sandwich', |
---|
197 | 'cest': 'Part-Time, Diploma, Certificate' |
---|
198 | } |
---|
199 | |
---|
200 | @property |
---|
201 | def tzinfo(self): |
---|
202 | return pytz.timezone('Africa/Lagos') |
---|