Changeset 9021 for main


Ignore:
Timestamp:
18 Jul 2012, 20:24:55 (12 years ago)
Author:
Henrik Bettermann
Message:

We bypass the request_clearance page if student
has been imported in state 'clearance started' and
no clr_code was entered before.

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

Legend:

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

    r9010 r9021  
    16651665            return
    16661666        self.flash(_('Clearance form has been saved.'))
    1667         self.redirect(self.url(self.context,'request_clearance'))
     1667        if self.context.clr_code:
     1668            self.redirect(self.url(self.context, 'request_clearance'))
     1669        else:
     1670            # We bypass the request_clearance page if student
     1671            # has been imported in state 'clearance started' and
     1672            # no clr_code was entered before.
     1673            state = IWorkflowState(self.context).getState()
     1674            if state != CLEARANCE:
     1675                # This shouldn't happen, but the application officer
     1676                # might have forgotten to lock the form after changing the state
     1677                self.flash(_('This form cannot be submitted. Wrong state!'))
     1678                return
     1679            IWorkflowInfo(self.context).fireTransition('request_clearance')
     1680            self.flash(_('Clearance has been requested.'))
     1681            self.redirect(self.url(self.context))
    16681682        return
    16691683
     
    16851699            return
    16861700        pin = '%s-%s-%s' % (self.ac_prefix, self.ac_series, self.ac_number)
    1687         if self.context.clr_code != pin:
     1701        if self.context.clr_code and self.context.clr_code != pin:
    16881702            self.flash(_("This isn't your CLR access code."))
    16891703            return
    16901704        state = IWorkflowState(self.context).getState()
    1691         # This shouldn't happen, but the application officer
    1692         # might have forgotten to lock the form after changing the state
    16931705        if state != CLEARANCE:
     1706            # This shouldn't happen, but the application officer
     1707            # might have forgotten to lock the form after changing the state
    16941708            self.flash(_('This form cannot be submitted. Wrong state!'))
    16951709            return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r9011 r9021  
    922922        self.assertTrue('clearance started' in self.browser.contents)
    923923        self.browser.open(self.history_path)
    924         self.assertTrue("Reset to 'clearance' by My Public Name" in
     924        self.assertTrue("Reset to 'clearance started' by My Public Name" in
    925925            self.browser.contents)
    926926        IWorkflowInfo(self.student).fireTransition('request_clearance')
     
    13041304        self.assertEqual(self.student.state, 'courses registered')
    13051305        return
     1306
     1307    def test_student_clearance_wo_clrcode(self):
     1308        IWorkflowState(self.student).setState('clearance started')
     1309        self.browser.open(self.login_path)
     1310        self.browser.getControl(name="form.login").value = self.student_id
     1311        self.browser.getControl(name="form.password").value = 'spwd'
     1312        self.browser.getControl("Login").click()
     1313        self.student.clearance_locked = False
     1314        self.browser.open(self.edit_clearance_path)
     1315        self.browser.getControl(name="form.date_of_birth").value = '09/10/1961'
     1316        self.browser.getControl("Save and request clearance").click()
     1317        self.assertMatches('...Clearance has been requested...',
     1318                           self.browser.contents)
    13061319
    13071320    def test_manage_payments(self):
Note: See TracChangeset for help on using the changeset viewer.