Ignore:
Timestamp:
22 May 2013, 15:59:20 (11 years ago)
Author:
Henrik Bettermann
Message:

Remove redundant methods. This is now part of the base package.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/students
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py

    r10025 r10200  
    4646from waeup.uniben.interfaces import MessageFactory as _
    4747
    48 class CustomStudentTriggerTransitionFormPage(StudentTriggerTransitionFormPage):
    49     """ View to manage student base data
    50     """
    51 
    52     def getTransitions(self):
    53         """Return a list of dicts of allowed transition ids and titles.
    54 
    55         Each list entry provides keys ``name`` and ``title`` for
    56         internal name and (human readable) title of a single
    57         transition.
    58         """
    59         wf_info = IWorkflowInfo(self.context)
    60         allowed_transitions = [t for t in wf_info.getManualTransitions()
    61             if not t[0].startswith('pay')]
    62         if self.context.is_postgrad and not self.context.is_special_postgrad:
    63             allowed_transitions = [t for t in allowed_transitions
    64                 if not t[0] in FORBIDDEN_POSTGRAD_TRANS]
    65         return [dict(name='', title=_('No transition'))] +[
    66             dict(name=x, title=y) for x, y in allowed_transitions]
    67 
    6848class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage):
    6949    """ Page to view an online payment ticket
     
    163143    """
    164144    grok.template('studyleveleditpage')
    165 
    166     def _registerCourses(self, **data):
    167         """ This customized version does allow 'special postgraduate'
    168         students to register their courses.
    169         """
    170         if self.context.student.is_postgrad and \
    171             not self.context.student.is_special_postgrad:
    172             self.flash(_(
    173                 "You are a postgraduate student, "
    174                 "your course list can't bee registered."))
    175             self.redirect(self.url(self.context))
    176             return
    177         students_utils = getUtility(IStudentsUtils)
    178         max_credits = students_utils.maxCredits(self.context)
    179         if self.context.total_credits > max_credits:
    180             self.flash(_('Maximum credits of ${a} exceeded.',
    181                 mapping = {'a':max_credits}))
    182             return
    183         IWorkflowInfo(self.context.student).fireTransition(
    184             'register_courses')
    185         self.flash(_('Course list has been registered.'))
    186         self.redirect(self.url(self.context))
    187         return
    188145
    189146class CustomStudyLevelDisplayFormPage(StudyLevelDisplayFormPage):
  • main/waeup.uniben/trunk/src/waeup/uniben/students/student.py

    r9251 r10200  
    3535    grok.provides(ICustomStudent)
    3636
    37     @property
    38     def is_special_postgrad(self):
    39         is_special_postgrad = getattr(
    40             self.get('studycourse', None), 'is_special_postgrad', False)
    41         return is_special_postgrad
    42 
    4337
    4438# Set all attributes of Student required in IStudent as field
  • main/waeup.uniben/trunk/src/waeup/uniben/students/studycourse.py

    r9360 r10200  
    4848        return self.certificate.study_mode.startswith('special_pg')
    4949
    50     @property
    51     def next_session_allowed(self):
    52         state = self.student.state
    53         certificate = getattr(self, 'certificate', None)
    54         if certificate == None:
    55             return False
    56         if state == CLEARED:
    57             return True
    58         cond0 = state == RETURNING
    59         cond1 = self.current_verdict in (
    60             'A','B','C','F','J','L','M','N','O','X','Z')
    61         cond2 = self.current_level in (0, 100)
    62         cond3 = certificate.study_mode.startswith('de') and \
    63             self.current_level == 200
    64         cond4 = certificate.study_mode.startswith('ph') and \
    65             self.current_level == 300
    66         if cond0 and (cond1 or cond2 or cond3 or cond4):
    67             return True
    68         cond5 = self.is_postgrad
    69         cond6 = state == PAID
    70         cond7 = self.is_special_postgrad
    71         if  cond5 and cond6 and not cond7:
    72             return True
    73         return False
    74 
    7550CustomStudentStudyCourse = attrs_to_fields(CustomStudentStudyCourse)
    7651
Note: See TracChangeset for help on using the changeset viewer.