Ignore:
Timestamp:
2 Nov 2016, 07:14:58 (8 years ago)
Author:
Henrik Bettermann
Message:

Replace course_registration_allowed by course_registration_forbidden method.

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

Legend:

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

    r14226 r14247  
    15921592            emit_lock_message(self)
    15931593            return
    1594         elif not self.context.course_registration_allowed:
     1594        try:
     1595            deadline = grok.getSite()['configuration'][
     1596                str(self.context.level_session)].coursereg_deadline
     1597        except (TypeError, KeyError):
     1598            deadline = None
     1599        if deadline and deadline < datetime.now(pytz.utc):
    15951600            self.flash(_(
    15961601                "Course registration has ended. "
     
    27242729                mapping = {'a':max_credits}), type="warning")
    27252730            return
    2726         if not self.context.course_registration_allowed:
    2727             self.flash(_(
    2728                 "Course registration has ended. "
    2729                 "Please pay the late registration fee."), type="warning")
    2730             #self.redirect(self.url(self.context))
     2731        msg = self.context.course_registration_forbidden
     2732        if msg:
     2733            self.flash(msg, type="warning")
    27312734            return
    27322735        IWorkflowInfo(self.context.student).fireTransition(
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r14159 r14247  
    555555    gpa_params_rectified = Attribute('Corrected sessional GPA parameters')
    556556    gpa_params = Attribute('GPA parameters for this level.')
    557     cumulative_params = Attribute('Cumulative GPA and other cumulative parameters for this level')
    558     course_registration_allowed = Attribute('True if registerin courses is allowed')
     557    cumulative_params = Attribute(
     558        'Cumulative GPA and other cumulative parameters for this level')
     559    course_registration_forbidden = Attribute(
     560        'Return error message if course registration is forbidden')
    559561
    560562    level = schema.Choice(
  • main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py

    r14200 r14247  
    3232from waeup.kofa.utils.helpers import attrs_to_fields
    3333from waeup.kofa.students.vocabularies import StudyLevelSource
     34from waeup.kofa.interfaces import MessageFactory as _
    3435
    3536def find_carry_over(ticket):
     
    223224
    224225    @property
    225     def course_registration_allowed(self):
     226    def course_registration_forbidden(self):
    226227        try:
    227228            deadline = grok.getSite()['configuration'][
    228229                str(self.level_session)].coursereg_deadline
    229230        except (TypeError, KeyError):
    230             return True
     231            return
    231232        if not deadline or deadline > datetime.now(pytz.utc):
    232             return True
    233         payment_made = False
     233            return
    234234        if len(self.student['payments']):
    235235            for ticket in self.student['payments'].values():
     
    237237                    ticket.p_session == self.level_session and \
    238238                    ticket.p_state == 'paid':
    239                         payment_made = True
    240         if payment_made:
    241             return True
    242         return False
     239                        return
     240        return _("Course registration has ended. "
     241                 "Please pay the late registration fee.")
    243242
    244243    def addCourseTicket(self, ticket, course):
Note: See TracChangeset for help on using the changeset viewer.