[7569] | 1 | ## $Id: utils.py 8247 2012-04-22 12:56:07Z 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 | ## |
---|
[7822] | 18 | """Customize general helper utilities for Kofa. |
---|
[7569] | 19 | """ |
---|
| 20 | import os |
---|
[8188] | 21 | import pytz |
---|
[8064] | 22 | from waeup.kofa.utils.utils import KofaUtils, sorted_phone_prefixes |
---|
[8020] | 23 | from waeup.uniben.interfaces import MessageFactory as _ |
---|
[7569] | 24 | |
---|
[8064] | 25 | INT_PHONE_PREFIXES = [ |
---|
[8178] | 26 | (1, _('Nigeria'), '234'), |
---|
[8064] | 27 | (99, _('Germany'), '49'), |
---|
| 28 | (99, _('United States'), '1'), |
---|
[8083] | 29 | (99, _('Niger'), '227'), |
---|
[8064] | 30 | (99, _('Benin'), '229'), |
---|
| 31 | (99, _('Cameroon'), '237'), |
---|
| 32 | (99, _('United Kingdom'), '44'), |
---|
| 33 | (99, _('France'), '33'), |
---|
| 34 | ] |
---|
[7926] | 35 | |
---|
[7822] | 36 | class KofaUtils(KofaUtils): |
---|
[7569] | 37 | """A collection of methods subject to customization. |
---|
| 38 | """ |
---|
[7695] | 39 | PORTAL_LANGUAGE = 'en' |
---|
[7845] | 40 | |
---|
[8064] | 41 | # We do not dosplay the language selector at the moment. |
---|
[7845] | 42 | PREFERRED_LANGUAGES_DICT = { |
---|
| 43 | } |
---|
| 44 | |
---|
[8064] | 45 | #: A function to return |
---|
| 46 | @classmethod |
---|
| 47 | def sorted_phone_prefixes(cls, data=INT_PHONE_PREFIXES, request=None): |
---|
| 48 | return sorted_phone_prefixes(data, request) |
---|
| 49 | |
---|
[7845] | 50 | EXAM_SUBJECTS_DICT = { |
---|
| 51 | 'accounts': 'Accounts', |
---|
| 52 | 'add_general_science': 'Add General Science', |
---|
| 53 | 'add_maths': 'Add Maths', |
---|
[8242] | 54 | 'adv_elect_install_maint': 'Adv. Electrical Installation and Maintenance', |
---|
[7845] | 55 | 'agricultural_science': 'Agricultural Science', |
---|
| 56 | 'applied_electricity': 'Applied Electricity', |
---|
| 57 | 'arabi': 'Arabic', |
---|
| 58 | 'arithmetics': 'Arithmetics', |
---|
| 59 | 'art': 'Art', |
---|
| 60 | 'auto_mechanics': 'Auto Mechanics', |
---|
| 61 | 'basic_electricity': 'Basic Electricity', |
---|
| 62 | 'bible_knowledge': 'Bible Knowledge', |
---|
| 63 | 'biology': 'Biology', |
---|
| 64 | 'biology_alt_syl': 'Biology (Alt.Syl)', |
---|
| 65 | 'book_keeping': 'Book Keeping', |
---|
| 66 | 'building_construction': 'Building Construction', |
---|
| 67 | 'business_management': 'Business Management', |
---|
| 68 | 'business_construction_management': 'Business/Construction Management (Adv)', |
---|
| 69 | 'chemistry': 'Chemistry', |
---|
| 70 | 'chemistry_alt_syl': 'Chemistry (Alt.Syl)', |
---|
| 71 | 'christian_religious_studies': 'Christian Religious Studies', |
---|
| 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 | 'industrial_electrical_installation': 'Industrial Elect Installation (Adv)', |
---|
| 96 | 'intergrated_science': 'Intergrated Science', |
---|
| 97 | 'islamic_studies': 'Islamic Studies', |
---|
| 98 | 'literature_in_english': 'Literature in English', |
---|
| 99 | 'literature_in_nigerian_languages': 'Literature in Nigerian Languages', |
---|
| 100 | 'igbo': 'Igbo', |
---|
| 101 | 'igbo_literature': 'Igbo Literature', |
---|
| 102 | 'yoruba': 'Yoruba', |
---|
| 103 | 'yoruba_literature': 'Yoruba Literature', |
---|
| 104 | 'management_in_living': 'Management in Living', |
---|
| 105 | 'mathematics': 'Mathematics', |
---|
| 106 | 'metalwork': 'Metalwork', |
---|
| 107 | 'music': 'Music', |
---|
| 108 | 'nigerian_language': 'Nigerian Language', |
---|
| 109 | 'office_practice': 'Office Practice', |
---|
| 110 | 'physical_education': 'Physical Education', |
---|
| 111 | 'physical_health_education': 'Physical and Health Education', |
---|
| 112 | 'physics': 'Physics', |
---|
| 113 | 'physics_alt_syl': 'Physics (Alt.Syl)', |
---|
| 114 | 'principles_of_cost_accounting': 'Principles of Cost Accounting', |
---|
| 115 | 'rural_science': 'Rural Science', |
---|
| 116 | 'science': 'Science', |
---|
| 117 | 'secretarial_duties': 'Secretarial Duties', |
---|
| 118 | 'shorthand': 'Shorthand', |
---|
| 119 | 'sierra_leone_studies': 'Sierra Leone Studies', |
---|
| 120 | 'sierra_leone_languages': 'Sierra Leone Languages', |
---|
| 121 | 'social_studies': 'Social Studies', |
---|
| 122 | 'statistics': 'Statistics', |
---|
| 123 | 'teaching_practice': 'Teaching Practice', |
---|
| 124 | 'technical_drawing': 'Technical Drawing', |
---|
| 125 | 'typewriting': 'Typewriting', |
---|
| 126 | 'visual_art': 'Visual Art', |
---|
| 127 | 'woodwork': 'Woodwork', |
---|
| 128 | 'winding_elect_machines': 'Winding of Elect Machines and Elect Eng Sc' |
---|
| 129 | } |
---|
| 130 | |
---|
[7920] | 131 | EXAM_GRADES = ( |
---|
| 132 | ('A1', 'Excellent (A1)'), |
---|
| 133 | ('A2', 'Very Good (A2)'), |
---|
| 134 | ('A3', 'Good (A3)'), |
---|
| 135 | ('B2', 'Very Good (B2)'), |
---|
| 136 | ('B3', 'Good (B3)'), |
---|
| 137 | ('C4', 'Credit (C4)'), |
---|
| 138 | ('C5', 'Credit (C5)'), |
---|
| 139 | ('C6', 'Credit (C6)'), |
---|
[8178] | 140 | ('A', 'Pass (A)'), |
---|
| 141 | ('B', 'Pass (B)'), |
---|
| 142 | ('C', 'Pass (C)'), |
---|
| 143 | ('U', 'Pass (U)'), |
---|
[7920] | 144 | ('D7', 'Pass (D7)'), |
---|
[8124] | 145 | ('P7', 'Pass (P7)'), |
---|
| 146 | ('P8', 'Pass (P8)'), |
---|
[7920] | 147 | ('E8', 'Pass (E8)'), |
---|
| 148 | ('F9', 'Fail (F9)'), |
---|
| 149 | ('Aa', 'A (a)'), |
---|
| 150 | ('Bb', 'B (b)'), |
---|
| 151 | ('Cc', 'C (c)'), |
---|
| 152 | ('Dd', 'D (d)'), |
---|
| 153 | ('Ee', 'E (e)'), |
---|
| 154 | ('Ff', 'F (f)'), |
---|
| 155 | ('Gg', 'G (g)') |
---|
| 156 | ) |
---|
[7845] | 157 | |
---|
| 158 | INST_TYPES_DICT = { |
---|
[8085] | 159 | 'none': '', |
---|
[7845] | 160 | 'faculty': 'Faculty of', |
---|
| 161 | 'department': 'Department of', |
---|
| 162 | 'school': 'School of', |
---|
| 163 | 'office': 'Office for', |
---|
| 164 | 'centre': 'Centre for', |
---|
| 165 | 'institute': 'Institute of', |
---|
| 166 | 'school_for': 'School for', |
---|
[8085] | 167 | 'college': 'College of', |
---|
[7845] | 168 | } |
---|
| 169 | |
---|
| 170 | STUDY_MODES_DICT = { |
---|
| 171 | 'rmd_ft': 'Remedial with deficiencies', |
---|
| 172 | 'dp_pt': 'Diploma Part Time', |
---|
| 173 | 'ct_ft': 'Certificate Full Time', |
---|
| 174 | 'dp_ft': 'Diploma Full Time', |
---|
| 175 | 'de_pt': 'Direct Entry Part Time', |
---|
| 176 | 'pg_ft': 'Postgraduate Full Time', |
---|
| 177 | 'pg_pt': 'Postgraduate Part Time', |
---|
| 178 | 'jm_ft': 'Joint Matriculation Full Time', |
---|
| 179 | 'ume_ft': 'UME Full Time', |
---|
| 180 | 'de_ft': 'Direct Entry Full Time', |
---|
| 181 | 'ph_ft': 'Post Higher Education Full Time', |
---|
| 182 | 'transfer_pt': 'Transfer Part Time', |
---|
| 183 | 'ug_pt': 'Undergraduate Part Time', |
---|
| 184 | 'transfer_ft': 'Transfer Full Time', |
---|
| 185 | 'ct_pt': 'Certificate Part Time', |
---|
| 186 | 'ug_ft': 'Undergraduate Full Time', |
---|
| 187 | 'rm_ft': 'Remedial' |
---|
| 188 | } |
---|
| 189 | |
---|
| 190 | APP_CATS_DICT = { |
---|
| 191 | 'basic': 'PUME, PDE, PCE, PRENCE', |
---|
| 192 | 'no': 'no application', |
---|
[8064] | 193 | 'pg_ft': 'Postgraduate Full-Time', |
---|
| 194 | 'pg_pt': 'Postgraduate Part-Time', |
---|
[7845] | 195 | 'sandwich': 'Sandwich', |
---|
| 196 | 'cest': 'Part-Time, Diploma, Certificate' |
---|
| 197 | } |
---|
[8188] | 198 | |
---|
| 199 | @property |
---|
| 200 | def tzinfo(self): |
---|
| 201 | return pytz.timezone('Africa/Lagos') |
---|