source: main/waeup.custom/trunk/src/waeup/custom/utils/utils.py @ 7926

Last change on this file since 7926 was 7926, checked in by Henrik Bettermann, 13 years ago

Avoid duplicate code.

  • Property svn:keywords set to Id
File size: 7.6 KB
RevLine 
[7569]1## $Id: utils.py 7926 2012-03-20 10:14:00Z 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"""
20import os
[7822]21from waeup.kofa.utils.utils import KofaUtils
[7926]22from waeup.kofa.accesscodes import create_accesscode
23from waeup.custom.interfaces import MessageFactory as _
[7569]24
[7926]25def actions_after_payment(student, payment, view):
26    if payment.p_category == 'clearance':
27        # Create CLR access code
28        pin, error = create_accesscode('CLR',0,student.student_id)
29        if error:
30            view.flash(_('Valid callback received. ${a}',
31                mapping = {'a':error}))
32            return
33        payment.ac = pin
34    elif payment.p_category == 'schoolfee':
35        # Create SFE access code
36        pin, error = create_accesscode('SFE',0,student.student_id)
37        if error:
38            view.flash(_('Valid callback received. ${a}',
39                mapping = {'a':error}))
40            return
41        payment.ac = pin
42    elif payment.p_category == 'bed_allocation':
43        # Create HOS access code
44        pin, error = create_accesscode('HOS',0,student.student_id)
45        if error:
46            view.flash(_('Valid callback received. ${a}',
47                mapping = {'a':error}))
48            return
49        payment.ac = pin
50    view.flash(_('Valid callback received.'))
51    return
[7569]52
[7926]53
[7822]54class KofaUtils(KofaUtils):
[7569]55    """A collection of methods subject to customization.
56    """
[7695]57    PORTAL_LANGUAGE = 'en'
[7845]58
59    PREFERRED_LANGUAGES_DICT = {
60        'en':(1, u'English'),
61        'fr':(2, u'Français'),
62        'de':(3, u'Deutsch'),
63        'ha':(4, u'Hausa'),
64        'yo':(5, u'Yoruba'),
65        'ig':(6, u'Igbo'),
66        }
67
68    EXAM_SUBJECTS_DICT = {
69        'accounts': 'Accounts',
70        'add_general_science': 'Add General Science',
71        'add_maths': 'Add Maths',
72        'agricultural_science': 'Agricultural Science',
73        'applied_electricity': 'Applied Electricity',
74        'arabi': 'Arabic',
75        'arithmetics': 'Arithmetics',
76        'art': 'Art',
77        'auto_mechanics': 'Auto Mechanics',
78        'basic_electricity': 'Basic Electricity',
79        'bible_knowledge': 'Bible Knowledge',
80        'biology': 'Biology',
81        'biology_alt_syl': 'Biology (Alt.Syl)',
82        'book_keeping': 'Book Keeping',
83        'building_construction': 'Building Construction',
84        'business_management': 'Business Management',
85        'business_construction_management': 'Business/Construction Management (Adv)',
86        'chemistry': 'Chemistry',
87        'chemistry_alt_syl': 'Chemistry (Alt.Syl)',
88        'christian_religious_studies': 'Christian Religious Studies',
89        'clerical_office_duties': 'Clerical Office Duties',
90        'clothing_and_textiles': 'Clothing and Textiles',
91        'commerce': 'Commerce',
92        'economics': 'Economics',
93        'education': 'Education',
94        'efik': 'Efik',
95        'electronics': 'Electronics',
96        'elementary_surveying': 'Elementary Surveying',
97        'english_language': 'English Language',
98        'engineering_science': 'Engineering Science',
99        'financial_accounting': 'Financial Accounting',
100        'food_and_nutrition': 'Food and Nutrition',
101        'french': 'French',
102        'further_mathematics': 'Further Mathematics',
103        'general_science': 'General Science',
104        'geography': 'Geography',
105        'german': 'German',
106        'government': 'Government',
107        'hausa': 'Hausa',
108        'hausa_literature': 'Hausa Literature',
109        'health_science': 'Health Science',
110        'history': 'History',
111        'home_management': 'Home Management',
112        'industrial_electrical_installation': 'Industrial Elect Installation (Adv)',
113        'intergrated_science': 'Intergrated Science',
114        'islamic_studies': 'Islamic Studies',
115        'literature_in_english': 'Literature in English',
116        'literature_in_nigerian_languages': 'Literature in Nigerian Languages',
117        'igbo': 'Igbo',
118        'igbo_literature': 'Igbo Literature',
119        'yoruba': 'Yoruba',
120        'yoruba_literature': 'Yoruba Literature',
121        'management_in_living': 'Management in Living',
122        'mathematics': 'Mathematics',
123        'metalwork': 'Metalwork',
124        'music': 'Music',
125        'nigerian_language': 'Nigerian Language',
126        'office_practice': 'Office Practice',
127        'physical_education': 'Physical Education',
128        'physical_health_education': 'Physical and Health Education',
129        'physics': 'Physics',
130        'physics_alt_syl': 'Physics (Alt.Syl)',
131        'principles_of_cost_accounting': 'Principles of Cost Accounting',
132        'rural_science': 'Rural Science',
133        'science': 'Science',
134        'secretarial_duties': 'Secretarial Duties',
135        'shorthand': 'Shorthand',
136        'sierra_leone_studies': 'Sierra Leone Studies',
137        'sierra_leone_languages': 'Sierra Leone Languages',
138        'social_studies': 'Social Studies',
139        'statistics': 'Statistics',
140        'teaching_practice': 'Teaching Practice',
141        'technical_drawing': 'Technical Drawing',
142        'typewriting': 'Typewriting',
143        'visual_art': 'Visual Art',
144        'woodwork': 'Woodwork',
145        'winding_elect_machines': 'Winding of Elect Machines and Elect Eng Sc'
146        }
147
[7920]148    EXAM_GRADES = (
149        ('A1', 'Excellent (A1)'),
150        ('A2', 'Very Good (A2)'),
151        ('A3', 'Good (A3)'),
152        ('B2', 'Very Good (B2)'),
153        ('B3', 'Good (B3)'),
154        ('C4', 'Credit (C4)'),
155        ('C5', 'Credit (C5)'),
156        ('C6', 'Credit (C6)'),
157        ('D7', 'Pass (D7)'),
158        ('E8', 'Pass (E8)'),
159        ('F9', 'Fail (F9)'),
160        ('Aa', 'A (a)'),
161        ('Bb', 'B (b)'),
162        ('Cc', 'C (c)'),
163        ('Dd', 'D (d)'),
164        ('Ee', 'E (e)'),
165        ('Ff', 'F (f)'),
166        ('Gg', 'G (g)')
167        )
[7845]168
169    INST_TYPES_DICT = {
170        'faculty': 'Faculty of',
171        'department': 'Department of',
172        'school': 'School of',
173        'office': 'Office for',
174        'centre': 'Centre for',
175        'institute': 'Institute of',
176        'school_for': 'School for',
177        }
178
179    STUDY_MODES_DICT = {
180        'rmd_ft': 'Remedial with deficiencies',
181        'dp_pt': 'Diploma Part Time',
182        'ct_ft': 'Certificate Full Time',
183        'dp_ft': 'Diploma Full Time',
184        'de_pt': 'Direct Entry Part Time',
185        'pg_ft': 'Postgraduate Full Time',
186        'pg_pt': 'Postgraduate Part Time',
187        'jm_ft': 'Joint Matriculation Full Time',
188        'ume_ft': 'UME Full Time',
189        'de_ft': 'Direct Entry Full Time',
190        'ph_ft': 'Post Higher Education Full Time',
191        'transfer_pt': 'Transfer Part Time',
192        'ug_pt': 'Undergraduate Part Time',
193        'transfer_ft': 'Transfer Full Time',
194        'ct_pt': 'Certificate Part Time',
195        'ug_ft': 'Undergraduate Full Time',
196        'rm_ft': 'Remedial'
197        }
198
199    APP_CATS_DICT = {
200        'basic': 'PUME, PDE, PCE, PRENCE',
201        'no': 'no application',
202        'pg': 'Postgraduate',
203        'sandwich': 'Sandwich',
204        'cest': 'Part-Time, Diploma, Certificate'
205        }
Note: See TracBrowser for help on using the repository browser.