Changeset 7841


Ignore:
Timestamp:
12 Mar 2012, 08:04:03 (13 years ago)
Author:
Henrik Bettermann
Message:

We don't need methods to fetch dictionaries.

Update interfaces.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py

    r7837 r7841  
    8383
    8484    def getValues(self):
    85         subjects_dict = getUtility(IKofaUtils).getExamSubjectsDict()
     85        subjects_dict = getUtility(IKofaUtils).EXAM_SUBJECTS_DICT
    8686        return sorted(subjects_dict.keys())
    8787
    8888    def getTitle(self, value):
    89         subjects_dict = getUtility(IKofaUtils).getExamSubjectsDict()
     89        subjects_dict = getUtility(IKofaUtils).EXAM_SUBJECTS_DICT
    9090        return "%s:" % subjects_dict[value]
    9191
     
    9393
    9494    def getValues(self):
    95         grades_dict = getUtility(IKofaUtils).getExamGradesDict()
     95        grades_dict = getUtility(IKofaUtils).EXAM_GRADES_DICT
    9696        return sorted(grades_dict.keys())
    9797
    9898    def getTitle(self, value):
    99         grades_dict = getUtility(IKofaUtils).getExamGradesDict()
     99        grades_dict = getUtility(IKofaUtils).EXAM_GRADES_DICT
    100100        return grades_dict[value]
    101101
     
    189189    """
    190190
    191     def storage():
    192         """Return the initial storage path of the data center.
    193         """
     191    PORTAL_LANGUAGE = Attribute("Dict of global language setting")
     192    PREFERRED_LANGUAGES_DICT = Attribute("Dict of preferred languages")
     193    EXAM_SUBJECTS_DICT = Attribute("Dict of examination subjects")
     194    EXAM_GRADES_DICT = Attribute("Dict of examination grades")
     195    INST_TYPES_DICT = Attribute("Dict if institution types")
     196    STUDY_MODES_DICT = Attribute("Dict of study modes")
     197    APP_CATS_DICT = Attribute("Dict of application categories")
     198    SEMESTER_DICT = Attribute("Dict of semesters or trimesters")
    194199
    195200    def sendContactForm(
     
    214219    def genPassword(length, chars):
    215220        """Generate a random password.
    216         """
    217 
    218     def getVerdictsDict():
    219         """Provide a dict of verdicts.
    220221        """
    221222
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r7834 r7841  
    552552    def current_mode(self):
    553553        if self.context.certificate is not None:
    554             studymodes_dict = getUtility(IKofaUtils).getStudyModesDict()
     554            studymodes_dict = getUtility(IKofaUtils).STUDY_MODES_DICT
    555555            return studymodes_dict[self.context.certificate.study_mode]
    556556        return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r7819 r7841  
    4040    """
    4141    def getValues(self, context):
    42         verdicts_dict = getUtility(IStudentsUtils).getVerdictsDict()
     42        verdicts_dict = getUtility(IStudentsUtils).VERDICTS_DICT
    4343        return verdicts_dict.keys()
    4444
     
    4747
    4848    def getTitle(self, context, value):
    49         verdicts_dict = getUtility(IStudentsUtils).getVerdictsDict()
     49        verdicts_dict = getUtility(IStudentsUtils).VERDICTS_DICT
    5050        return verdicts_dict[value]
    5151
     
    5555
    5656    """
     57    def setReturningData(student):
     58        """ This method defines what happens after school fee payment
     59        depending on the student's senate verdict.
     60
     61        In the base configuration current level is always increased
     62        by 100 no matter which verdict has been assigned.
     63        """
     64
    5765    def getPaymentDetails(category, student):
    5866        """Get the payment dates of a student for the payment category
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r7819 r7841  
    177177
    178178    def setReturningData(self, student):
     179        """ This method defines what happens after school fee payment
     180        depending on the student's senate verdict.
     181
     182        In the base configuration current level is always increased
     183        by 100 no matter which verdict has been assigned.
     184        """
    179185        student['studycourse'].current_level += 100
    180186        student['studycourse'].current_session += 1
     
    185191
    186192    def getPaymentDetails(self, category, student):
     193        """Get the payment dates of a student for the payment category
     194        specified.
     195        """
    187196        d = {}
    188197        d['p_item'] = u''
     
    211220
    212221    def getAccommodationDetails(self, student):
     222        """Determine the accommodation dates of a student.
     223        """
    213224        d = {}
    214225        d['error'] = u''
     
    238249        return d
    239250
    240     # In the standard configuration we select the first bed found,
    241     # but can also randomize the selection if we like.
    242251    def selectBed(self, available_beds):
     252        """Select a bed from a list of available beds.
     253
     254        In the base configuration we select the first bed found,
     255        but can also randomize the selection if we like.
     256        """
    243257        return available_beds[0]
    244258
    245259    def renderPDF(self, view, filename='slip.pdf',
    246260        student=None, studentview=None, tableheader=None, tabledata=None):
     261        """Render pdf slips for various pages.
     262        """
    247263        # (0,0),(-1,-1) = whole table
    248264        # (0,0),(0,-1) = first column
     
    361377        return pdf.getpdfdata()
    362378
    363     def getVerdictsDict(self):
    364         """Provide a dictionary of verdicts.
    365         """
    366         return {
    367             '0': 'not yet',
    368             'A': 'Successful student',
    369             'B': 'Student with carryover courses',
    370             'C': 'Student on probation',
    371             'D': 'Withdrawn from the faculty',
    372             'E': 'Student who were previously on probation',
    373             'F': 'Medical case',
    374             'G': 'Absent from examination',
    375             'H': 'Withheld results',
    376             'I': 'Expelled/rusticated/suspended student',
    377             'J': 'Temporary withdrawn from the university',
    378             'K': 'Unregistered student',
    379             'L': 'Referred student',
    380             'M': 'Reinstatement',
    381             'N': 'Student on transfer',
    382             'O': 'NCE-III repeater',
    383             'Y': 'No previous verdict',
    384             'X': 'New 300 level student',
    385             'Z': 'Successful student (provisional)',
    386             'A1': 'First Class',
    387             'A2': 'Second Class Upper',
    388             'A3': 'Second Class Lower',
    389             'A4': 'Third Class',
    390             'A5': 'Pass',
    391             'A6': 'Distinction',
    392             'A7': 'Credit',
    393             'A8': 'Merit',
    394             }
     379    VERDICTS_DICT = {
     380        '0': 'not yet',
     381        'A': 'Successful student',
     382        'B': 'Student with carryover courses',
     383        'C': 'Student on probation',
     384        'D': 'Withdrawn from the faculty',
     385        'E': 'Student who were previously on probation',
     386        'F': 'Medical case',
     387        'G': 'Absent from examination',
     388        'H': 'Withheld results',
     389        'I': 'Expelled/rusticated/suspended student',
     390        'J': 'Temporary withdrawn from the university',
     391        'K': 'Unregistered student',
     392        'L': 'Referred student',
     393        'M': 'Reinstatement',
     394        'N': 'Student on transfer',
     395        'O': 'NCE-III repeater',
     396        'Y': 'No previous verdict',
     397        'X': 'New 300 level student',
     398        'Z': 'Successful student (provisional)',
     399        'A1': 'First Class',
     400        'A2': 'Second Class Upper',
     401        'A3': 'Second Class Lower',
     402        'A4': 'Third Class',
     403        'A5': 'Pass',
     404        'A6': 'Distinction',
     405        'A7': 'Credit',
     406        'A8': 'Merit',
     407        }
  • main/waeup.kofa/trunk/src/waeup/kofa/university/department.py

    r7819 r7841  
    7373
    7474    def longtitle(self):
    75         insttypes_dict = getUtility(IKofaUtils).getInstTypeDict()
     75        insttypes_dict = getUtility(IKofaUtils).INST_TYPES_DICT
    7676        return "%s %s (%s)" % (
    7777            insttypes_dict[self.title_prefix],
  • main/waeup.kofa/trunk/src/waeup/kofa/university/faculty.py

    r7819 r7841  
    6161
    6262    def longtitle(self):
    63         insttypes_dict = getUtility(IKofaUtils).getInstTypeDict()
     63        insttypes_dict = getUtility(IKofaUtils).INST_TYPES_DICT
    6464        result = "%s %s (%s)" % (
    6565            insttypes_dict[self.title_prefix],
  • main/waeup.kofa/trunk/src/waeup/kofa/university/vocabularies.py

    r7838 r7841  
    4646            # see sources below
    4747            from waeup.kofa.interfaces import IKofaUtils
    48             return getUtility(IKofaUtils).getSemesterDict().keys()
     48            return getUtility(IKofaUtils).SEMESTER_DICT.keys()
    4949        except:
    5050            return [9]
     
    5656        try:
    5757            from waeup.kofa.interfaces import IKofaUtils
    58             semesters_dict = getUtility(IKofaUtils).getSemesterDict()
     58            semesters_dict = getUtility(IKofaUtils).SEMESTER_DICT
    5959            return semesters_dict[value]
    6060        except:
     
    6666    """
    6767    def getValues(self, context):
    68         insttypes_dict = getUtility(IKofaUtils).getInstTypeDict()
     68        insttypes_dict = getUtility(IKofaUtils).INST_TYPES_DICT
    6969        return sorted(insttypes_dict.keys())
    7070
     
    7373
    7474    def getTitle(self, context, value):
    75         insttypes_dict = getUtility(IKofaUtils).getInstTypeDict()
     75        insttypes_dict = getUtility(IKofaUtils).INST_TYPES_DICT
    7676        return insttypes_dict[value]
    7777
     
    8181    """
    8282    def getValues(self, context):
    83         appcats_dict = getUtility(IKofaUtils).getAppCatDict()
     83        appcats_dict = getUtility(IKofaUtils).APP_CATS_DICT
    8484        return sorted(appcats_dict.keys())
    8585
     
    8888
    8989    def getTitle(self, context, value):
    90         appcats_dict = getUtility(IKofaUtils).getAppCatDict()
     90        appcats_dict = getUtility(IKofaUtils).APP_CATS_DICT
    9191        return appcats_dict[value]
    9292
     
    9696    """
    9797    def getValues(self, context):
    98         studymodes_dict = getUtility(IKofaUtils).getStudyModesDict()
     98        studymodes_dict = getUtility(IKofaUtils).STUDY_MODES_DICT
    9999        return sorted(studymodes_dict.keys())
    100100
     
    103103
    104104    def getTitle(self, context, value):
    105         studymodes_dict = getUtility(IKofaUtils).getStudyModesDict()
     105        studymodes_dict = getUtility(IKofaUtils).STUDY_MODES_DICT
    106106        return studymodes_dict[value]
    107107
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r7836 r7841  
    5757        }
    5858
    59     def getExamSubjectsDict(self):
    60         """Provide a dictionary of exam subjects.
    61         """
    62         return {
    63             'accounts': 'Accounts',
    64             'add_general_science': 'Add General Science',
    65             'add_maths': 'Add Maths',
    66             'agricultural_science': 'Agricultural Science',
    67             'applied_electricity': 'Applied Electricity',
    68             'arabi': 'Arabic',
    69             'arithmetics': 'Arithmetics',
    70             'art': 'Art',
    71             'auto_mechanics': 'Auto Mechanics',
    72             'basic_electricity': 'Basic Electricity',
    73             'bible_knowledge': 'Bible Knowledge',
    74             'biology': 'Biology',
    75             'biology_alt_syl': 'Biology (Alt.Syl)',
    76             'book_keeping': 'Book Keeping',
    77             'building_construction': 'Building Construction',
    78             'business_management': 'Business Management',
    79             'business_construction_management': 'Business/Construction Management (Adv)',
    80             'chemistry': 'Chemistry',
    81             'chemistry_alt_syl': 'Chemistry (Alt.Syl)',
    82             'christian_religious_studies': 'Christian Religious Studies',
    83             'clerical_office_duties': 'Clerical Office Duties',
    84             'clothing_and_textiles': 'Clothing and Textiles',
    85             'commerce': 'Commerce',
    86             'economics': 'Economics',
    87             'education': 'Education',
    88             'efik': 'Efik',
    89             'electronics': 'Electronics',
    90             'elementary_surveying': 'Elementary Surveying',
    91             'english_language': 'English Language',
    92             'engineering_science': 'Engineering Science',
    93             'financial_accounting': 'Financial Accounting',
    94             'food_and_nutrition': 'Food and Nutrition',
    95             'french': 'French',
    96             'further_mathematics': 'Further Mathematics',
    97             'general_science': 'General Science',
    98             'geography': 'Geography',
    99             'german': 'German',
    100             'government': 'Government',
    101             'hausa': 'Hausa',
    102             'hausa_literature': 'Hausa Literature',
    103             'health_science': 'Health Science',
    104             'history': 'History',
    105             'home_management': 'Home Management',
    106             'industrial_electrical_installation': 'Industrial Elect Installation (Adv)',
    107             'intergrated_science': 'Intergrated Science',
    108             'islamic_studies': 'Islamic Studies',
    109             'literature_in_english': 'Literature in English',
    110             'literature_in_nigerian_languages': 'Literature in Nigerian Languages',
    111             'igbo': 'Igbo',
    112             'igbo_literature': 'Igbo Literature',
    113             'yoruba': 'Yoruba',
    114             'yoruba_literature': 'Yoruba Literature',
    115             'management_in_living': 'Management in Living',
    116             'mathematics': 'Mathematics',
    117             'metalwork': 'Metalwork',
    118             'music': 'Music',
    119             'nigerian_language': 'Nigerian Language',
    120             'office_practice': 'Office Practice',
    121             'physical_education': 'Physical Education',
    122             'physical_health_education': 'Physical and Health Education',
    123             'physics': 'Physics',
    124             'physics_alt_syl': 'Physics (Alt.Syl)',
    125             'principles_of_cost_accounting': 'Principles of Cost Accounting',
    126             'rural_science': 'Rural Science',
    127             'science': 'Science',
    128             'secretarial_duties': 'Secretarial Duties',
    129             'shorthand': 'Shorthand',
    130             'sierra_leone_studies': 'Sierra Leone Studies',
    131             'sierra_leone_languages': 'Sierra Leone Languages',
    132             'social_studies': 'Social Studies',
    133             'statistics': 'Statistics',
    134             'teaching_practice': 'Teaching Practice',
    135             'technical_drawing': 'Technical Drawing',
    136             'typewriting': 'Typewriting',
    137             'visual_art': 'Visual Art',
    138             'woodwork': 'Woodwork',
    139             'winding_elect_machines': 'Winding of Elect Machines and Elect Eng Sc'
    140             }
    141 
    142     def getExamGradesDict(self):
    143         """Provide a dictionary of exam grades.
    144         """
    145         return {
    146             'A1': 'Excellent (A1)',
    147             'A2': 'Very Good (A2)',
    148             'A3': 'Good (A3)',
    149             'B2': 'Very Good (B2)',
    150             'B3': 'Good (B3)',
    151             'C4': 'Credit (C4)',
    152             'C5': 'Credit (C5)',
    153             'C6': 'Credit (C6)',
    154             'D7': 'Pass (D7)',
    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     def getInstTypeDict(self):
    167         """Provide a dictionary of study modes.
    168         """
    169         return {
     59    EXAM_SUBJECTS_DICT = {
     60        'accounts': 'Accounts',
     61        'add_general_science': 'Add General Science',
     62        'add_maths': 'Add Maths',
     63        'agricultural_science': 'Agricultural Science',
     64        'applied_electricity': 'Applied Electricity',
     65        'arabi': 'Arabic',
     66        'arithmetics': 'Arithmetics',
     67        'art': 'Art',
     68        'auto_mechanics': 'Auto Mechanics',
     69        'basic_electricity': 'Basic Electricity',
     70        'bible_knowledge': 'Bible Knowledge',
     71        'biology': 'Biology',
     72        'biology_alt_syl': 'Biology (Alt.Syl)',
     73        'book_keeping': 'Book Keeping',
     74        'building_construction': 'Building Construction',
     75        'business_management': 'Business Management',
     76        'business_construction_management': 'Business/Construction Management (Adv)',
     77        'chemistry': 'Chemistry',
     78        'chemistry_alt_syl': 'Chemistry (Alt.Syl)',
     79        'christian_religious_studies': 'Christian Religious Studies',
     80        'clerical_office_duties': 'Clerical Office Duties',
     81        'clothing_and_textiles': 'Clothing and Textiles',
     82        'commerce': 'Commerce',
     83        'economics': 'Economics',
     84        'education': 'Education',
     85        'efik': 'Efik',
     86        'electronics': 'Electronics',
     87        'elementary_surveying': 'Elementary Surveying',
     88        'english_language': 'English Language',
     89        'engineering_science': 'Engineering Science',
     90        'financial_accounting': 'Financial Accounting',
     91        'food_and_nutrition': 'Food and Nutrition',
     92        'french': 'French',
     93        'further_mathematics': 'Further Mathematics',
     94        'general_science': 'General Science',
     95        'geography': 'Geography',
     96        'german': 'German',
     97        'government': 'Government',
     98        'hausa': 'Hausa',
     99        'hausa_literature': 'Hausa Literature',
     100        'health_science': 'Health Science',
     101        'history': 'History',
     102        'home_management': 'Home Management',
     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_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_DICT = {
     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        'D7': 'Pass (D7)',
     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 = {
    170161        'faculty': 'Faculty of',
    171162        'department': 'Department of',
     
    177168        }
    178169
    179     def getStudyModesDict(self):
    180         """Provide a dictionary of study modes.
    181         """
    182         return {
     170    STUDY_MODES_DICT = {
    183171        'rmd_ft': 'Remedial with deficiencies',
    184172        'dp_pt': 'Diploma Part Time',
     
    200188        }
    201189
    202     def getAppCatDict(self):
    203         """Provide a dictionary of study modes.
    204         """
    205         return {
     190    APP_CATS_DICT = {
    206191        'basic': 'PUME, PDE, PCE, PRENCE',
    207192        'no': 'no application',
     
    211196        }
    212197
    213     def getSemesterDict(self):
    214         """Provide a dictionary of semester or trimester types.
    215         """
    216         return {
     198    SEMESTER_DICT = {
    217199        1: 'First Semester',
    218200        2: 'Second Semester',
Note: See TracChangeset for help on using the changeset viewer.