Ignore:
Timestamp:
3 Dec 2014, 06:43:26 (10 years ago)
Author:
Henrik Bettermann
Message:

Do only provide invitation letter if physical_clearance_date is set and student is in state 'clearance requested'.

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

    r12121 r12122  
    163163        return
    164164
     165
     166    def update(self):
     167        if self.context.student.state != REQUESTED \
     168            or not  self.context.student.physical_clearance_date:
     169            self.flash(_('Forbidden'), type="warning")
     170            self.redirect(self.url(self.context))
     171
    165172    def render(self):
    166173        studentview = StudentBasePDFFormPage(self.context.student,
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r12121 r12122  
    171171            attr="secr_cults.jpg")
    172172        file_store.createFile(file_id, StringIO(secr_cults))
     173        # Clearance invitation letter is not yet available
     174        self.browser.open(self.clearance_path)
     175        self.assertFalse('invitation slip' in self.browser.contents)
     176        self.browser.open(self.student_path + '/clearance_invitation_slip.pdf')
     177        self.assertTrue('Forbidden' in self.browser.contents)
    173178        self.browser.open(self.edit_clearance_path)
    174179        self.browser.getControl("Save and request clearance").click()
    175 
    176180        self.assertTrue('Clearance has been requested'
    177181            in self.browser.contents)
    178         # Student can export physical_clearance.slip
     182        # Now student can export physical_clearance.slip
    179183        self.app['configuration'].name = u'University of Benin'
    180184        self.student.physical_clearance_date = u'January 5th, 2015'
  • main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py

    r12121 r12122  
    6767    text = _('Download clearance invitation slip')
    6868    target = 'clearance_invitation_slip.pdf'
     69
     70    @property
     71    def target_url(self):
     72        if self.context.student.state == REQUESTED \
     73            and self.context.student.physical_clearance_date:
     74            return self.view.url(self.view.context, self.target)
     75        return False
    6976
    7077
Note: See TracChangeset for help on using the changeset viewer.