Changeset 11772


Ignore:
Timestamp:
31 Jul 2014, 04:38:23 (10 years ago)
Author:
Henrik Bettermann
Message:

Provide customizable method for disabling clearance by clearance officers.

Location:
main/waeup.kofa/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r11754 r11772  
    441.3dev (unreleased)
    55===================
     6
     7* Provide customizable method for disabling clearance by clearance officers.
    68
    79* Merge Javascript functions into one file. Add Javascript function
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r11732 r11772  
    135135        yield value_dict
    136136
    137 def clearance_disabled_message(student):
    138     try:
    139         session_config = grok.getSite()[
    140             'configuration'][str(student.current_session)]
    141     except KeyError:
    142         return _('Session configuration object is not available.')
    143     if not session_config.clearance_enabled:
    144         return _('Clearance is disabled for this session.')
    145     return None
    146 
    147137def addCourseTicket(view, course=None):
    148138    students_utils = getUtility(IStudentsUtils)
     
    768758
    769759    def update(self):
    770         if clearance_disabled_message(self.context):
    771             self.flash(clearance_disabled_message(self.context))
     760        cdm = getUtility(IStudentsUtils).clearance_disabled_message(self.context)
     761        if cdm:
     762            self.flash(cdm)
    772763            self.redirect(self.url(self.context,'view_clearance'))
    773764            return
     
    794785
    795786    def update(self):
    796         if clearance_disabled_message(self.context):
    797             self.flash(clearance_disabled_message(self.context), type="warning")
     787        cdm = getUtility(IStudentsUtils).clearance_disabled_message(self.context)
     788        if cdm:
     789            self.flash(cdm, type="warning")
    798790            self.redirect(self.url(self.context,'view_clearance'))
    799791            return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r11641 r11772  
    910910        return bedticket.bed_coordinates
    911911
     912    def clearance_disabled_message(self, student):
     913        try:
     914            session_config = grok.getSite()[
     915                'configuration'][str(student.current_session)]
     916        except KeyError:
     917            return _('Session configuration object is not available.')
     918        if not session_config.clearance_enabled:
     919            return _('Clearance is disabled for this session.')
     920        return None
     921
    912922    VERDICTS_DICT = {
    913923        '0': _('(not yet)'),
  • main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py

    r11612 r11772  
    3535    VALIDATED, GRADUATED, TRANSCRIPT)
    3636from waeup.kofa.students.browser import (
    37     clearance_disabled_message,
    3837    StudentClearanceManageFormPage,
    3938    StudentBaseManageFormPage, StudentFilesUploadPage,
     
    272271    @property
    273272    def target_url(self):
    274         if clearance_disabled_message(self.context):
     273        cdm = getUtility(IStudentsUtils).clearance_disabled_message(self.context)
     274        if cdm:
    275275            return ''
    276276        if self.context.state != REQUESTED:
     
    289289    @property
    290290    def target_url(self):
    291         if clearance_disabled_message(self.context):
     291        cdm = getUtility(IStudentsUtils).clearance_disabled_message(self.context)
     292        if cdm:
    292293            return ''
    293294        if self.context.state not in (REQUESTED, CLEARED):
Note: See TracChangeset for help on using the changeset viewer.