[8810] | 1 | ## $Id: utils.py 10156 2013-05-07 17:31:10Z 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 | |
---|
[8817] | 36 | class NigeriaKofaUtils(KofaUtils): |
---|
[8810] | 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 | 'basic_electricity': 'Basic Electricity', |
---|
| 67 | 'bible_knowledge': 'Bible Knowledge', |
---|
| 68 | 'biology': 'Biology', |
---|
| 69 | 'biology_alt_syl': 'Biology (Alt.Syl)', |
---|
| 70 | 'book_keeping': 'Book Keeping', |
---|
| 71 | 'building_construction': 'Building Construction', |
---|
| 72 | 'business_management': 'Business Management', |
---|
| 73 | 'business_construction_management': 'Business/Construction Management (Adv)', |
---|
| 74 | 'chemistry': 'Chemistry', |
---|
| 75 | 'chemistry_alt_syl': 'Chemistry (Alt.Syl)', |
---|
| 76 | 'christian_religious_studies': 'Christian Religious Studies', |
---|
| 77 | 'class_teaching': 'Class Teaching', |
---|
| 78 | 'clerical_office_duties': 'Clerical Office Duties', |
---|
| 79 | 'clothing_and_textiles': 'Clothing and Textiles', |
---|
| 80 | 'commerce': 'Commerce', |
---|
| 81 | 'economics': 'Economics', |
---|
| 82 | 'education': 'Education', |
---|
| 83 | 'efik': 'Efik', |
---|
| 84 | 'electronics': 'Electronics', |
---|
| 85 | 'elementary_surveying': 'Elementary Surveying', |
---|
| 86 | 'english_language': 'English Language', |
---|
| 87 | 'engineering_science': 'Engineering Science', |
---|
| 88 | 'financial_accounting': 'Financial Accounting', |
---|
| 89 | 'food_and_nutrition': 'Food and Nutrition', |
---|
| 90 | 'french': 'French', |
---|
| 91 | 'further_mathematics': 'Further Mathematics', |
---|
| 92 | 'general_science': 'General Science', |
---|
| 93 | 'geography': 'Geography', |
---|
| 94 | 'german': 'German', |
---|
| 95 | 'government': 'Government', |
---|
| 96 | 'hausa': 'Hausa', |
---|
| 97 | 'hausa_literature': 'Hausa Literature', |
---|
| 98 | 'health_science': 'Health Science', |
---|
| 99 | 'history': 'History', |
---|
| 100 | 'home_management': 'Home Management', |
---|
| 101 | 'human_biology': 'Human Biology', |
---|
| 102 | 'industrial_electrical_installation': 'Industrial Elect Installation (Adv)', |
---|
| 103 | 'intergrated_science': 'Intergrated Science', |
---|
| 104 | 'islamic_studies': 'Islamic Studies', |
---|
| 105 | 'literature_in_english': 'Literature in English', |
---|
| 106 | 'literature_in_nigerian_languages': 'Literature in Nigerian Languages', |
---|
| 107 | 'igbo': 'Igbo', |
---|
| 108 | 'igbo_literature': 'Igbo Literature', |
---|
| 109 | 'yoruba': 'Yoruba', |
---|
| 110 | 'yoruba_literature': 'Yoruba Literature', |
---|
| 111 | 'management_in_living': 'Management in Living', |
---|
| 112 | 'mathematics': 'Mathematics', |
---|
| 113 | 'metalwork': 'Metalwork', |
---|
| 114 | 'music': 'Music', |
---|
| 115 | 'nigerian_language': 'Nigerian Language', |
---|
| 116 | 'office_practice': 'Office Practice', |
---|
| 117 | 'physical_education': 'Physical Education', |
---|
| 118 | 'physical_health_education': 'Physical and Health Education', |
---|
| 119 | 'physics': 'Physics', |
---|
| 120 | 'physics_alt_syl': 'Physics (Alt.Syl)', |
---|
| 121 | 'principles_and_practice_of_education': 'Principles and Practice of Education', |
---|
| 122 | 'principles_of_cost_accounting': 'Principles of Cost Accounting', |
---|
| 123 | 'rural_science': 'Rural Science', |
---|
| 124 | 'science': 'Science', |
---|
| 125 | 'secretarial_duties': 'Secretarial Duties', |
---|
| 126 | 'shorthand': 'Shorthand', |
---|
| 127 | 'sierra_leone_studies': 'Sierra Leone Studies', |
---|
| 128 | 'sierra_leone_languages': 'Sierra Leone Languages', |
---|
| 129 | 'social_studies': 'Social Studies', |
---|
| 130 | 'statistics': 'Statistics', |
---|
| 131 | 'teaching_practice': 'Teaching Practice', |
---|
| 132 | 'technical_drawing': 'Technical Drawing', |
---|
| 133 | 'typewriting': 'Typewriting', |
---|
| 134 | 'visual_art': 'Visual Art', |
---|
| 135 | 'woodwork': 'Woodwork', |
---|
| 136 | 'winding_elect_machines': 'Winding of Elect Machines and Elect Eng Sc' |
---|
| 137 | } |
---|
| 138 | |
---|
| 139 | EXAM_GRADES = ( |
---|
| 140 | ('A1', 'Excellent (A1)'), |
---|
| 141 | ('A2', 'Very Good (A2)'), |
---|
| 142 | ('A3', 'Good (A3)'), |
---|
| 143 | ('B2', 'Very Good (B2)'), |
---|
| 144 | ('B3', 'Good (B3)'), |
---|
| 145 | ('C4', 'Credit (C4)'), |
---|
| 146 | ('C5', 'Credit (C5)'), |
---|
| 147 | ('C6', 'Credit (C6)'), |
---|
| 148 | ('A', 'Pass (A)'), |
---|
| 149 | ('B', 'Pass (B)'), |
---|
| 150 | ('C', 'Pass (C)'), |
---|
| 151 | ('U', 'Pass (U)'), |
---|
| 152 | ('D7', 'Pass (D7)'), |
---|
| 153 | ('P7', 'Pass (P7)'), |
---|
| 154 | ('P8', 'Pass (P8)'), |
---|
| 155 | ('E8', 'Pass (E8)'), |
---|
| 156 | ('F9', 'Fail (F9)'), |
---|
| 157 | ('Aa', 'A (a)'), |
---|
| 158 | ('Bb', 'B (b)'), |
---|
| 159 | ('Cc', 'C (c)'), |
---|
| 160 | ('Dd', 'D (d)'), |
---|
| 161 | ('Ee', 'E (e)'), |
---|
| 162 | ('Ff', 'F (f)'), |
---|
| 163 | ('Gg', 'G (g)') |
---|
| 164 | ) |
---|
| 165 | |
---|
| 166 | INST_TYPES_DICT = { |
---|
| 167 | 'none': '', |
---|
| 168 | 'faculty': 'Faculty of', |
---|
| 169 | 'department': 'Department of', |
---|
| 170 | 'school': 'School of', |
---|
| 171 | 'office': 'Office for', |
---|
| 172 | 'centre': 'Centre for', |
---|
| 173 | 'institute': 'Institute of', |
---|
| 174 | 'school_for': 'School for', |
---|
| 175 | 'college': 'College of', |
---|
| 176 | } |
---|
| 177 | |
---|
| 178 | STUDY_MODES_DICT = { |
---|
[9230] | 179 | 'ume_ft': 'UME Full Time', |
---|
[8934] | 180 | 'ug_ft': 'Undergraduate Full Time', |
---|
| 181 | 'ug_pt': 'Undergraduate Part Time', |
---|
[8810] | 182 | 'dp_pt': 'Diploma Part Time', |
---|
| 183 | 'ct_ft': 'Certificate Full Time', |
---|
| 184 | 'dp_ft': 'Diploma Full Time', |
---|
[8934] | 185 | 'de_ft': 'Direct Entry Full Time', |
---|
[8810] | 186 | 'de_pt': 'Direct Entry Part Time', |
---|
[9349] | 187 | 'nd_ft': 'National Diploma Full Time', |
---|
| 188 | 'nd_pt': 'National Diploma Part Time', |
---|
| 189 | 'hnd_ft': 'Higher National Diploma Full Time', |
---|
| 190 | 'hnd_pt': 'Higher National Diploma Part Time', |
---|
[8810] | 191 | 'pg_ft': 'Postgraduate Full Time', |
---|
| 192 | 'pg_pt': 'Postgraduate Part Time', |
---|
[9349] | 193 | 'pgd_ft': 'Postgraduate Diploma Full Time', |
---|
| 194 | 'pgd_pt': 'Postgraduate Diploma Part Time', |
---|
[10156] | 195 | 'special_pg_pt': 'Special Postgraduate Part Time', |
---|
[9941] | 196 | 'nce_ft': 'NCE Full Time', |
---|
| 197 | 'nce_pt': 'NCE Part Time', |
---|
[8934] | 198 | 'ug_sw': 'Undergraduate Sandwich', |
---|
[9942] | 199 | 'nce_sw': 'NCE Sandwich', |
---|
[8810] | 200 | 'jm_ft': 'Joint Matriculation Full Time', |
---|
| 201 | 'ph_ft': 'Post Higher Education Full Time', |
---|
| 202 | 'transfer_pt': 'Transfer Part Time', |
---|
| 203 | 'transfer_ft': 'Transfer Full Time', |
---|
| 204 | 'ct_pt': 'Certificate Part Time', |
---|
[8934] | 205 | 'rmd_ft': 'Remedial with deficiencies', |
---|
[9144] | 206 | 'rm_ft': 'Remedial', |
---|
[9163] | 207 | 'transfer': 'Transfer', |
---|
| 208 | 'prence': 'Pre-NCE', |
---|
[9349] | 209 | 'prend': 'Pre-ND', |
---|
[9164] | 210 | 'pce': 'PCE', |
---|
[9165] | 211 | 'pd_ft': 'Professional Diploma in Education', |
---|
[10087] | 212 | 'no': 'no application', |
---|
[8810] | 213 | } |
---|
| 214 | |
---|
| 215 | APP_CATS_DICT = { |
---|
[9077] | 216 | 'basic': 'PUTME, PUDE, PCE, PRENCE', |
---|
[9085] | 217 | 'no': 'No Application', |
---|
[8810] | 218 | 'pg_ft': 'Postgraduate Full-Time', |
---|
| 219 | 'pg_pt': 'Postgraduate Part-Time', |
---|
| 220 | 'sandwich': 'Sandwich', |
---|
[9085] | 221 | 'cest': 'Part-Time, Diploma, Certificate', |
---|
[8810] | 222 | } |
---|
| 223 | |
---|
| 224 | @property |
---|
| 225 | def tzinfo(self): |
---|
| 226 | return pytz.timezone('Africa/Lagos') |
---|