Ignore:
Timestamp:
26 Jun 2015, 06:05:43 (9 years ago)
Author:
Henrik Bettermann
Message:

Remove manual clearance lock. Replace clearance_locked field by
property attribute.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
8 edited

Legend:

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

    r12957 r13103  
    334334        # No students yet
    335335        self.assertEqual(self.browser.contents,
    336             'adm_code,clearance_locked,clr_code,date_of_birth,email,'
     336            'adm_code,clr_code,date_of_birth,email,'
    337337            'employer,firstname,lastname,matric_number,middlename,'
    338338            'nationality,officer_comment,perm_address,personal_updated,'
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r13089 r13103  
    638638    def form_fields(self):
    639639        if self.context.is_postgrad:
    640             form_fields = grok.AutoFields(
    641                 IPGStudentClearance).omit('clearance_locked')
    642         else:
    643             form_fields = grok.AutoFields(
    644                 IUGStudentClearance).omit('clearance_locked')
     640            form_fields = grok.AutoFields(IPGStudentClearance)
     641        else:
     642            form_fields = grok.AutoFields(IUGStudentClearance)
    645643        if not getattr(self.context, 'officer_comment'):
    646644            form_fields = form_fields.omit('officer_comment')
     
    669667    def form_fields(self):
    670668        if self.context.is_postgrad:
    671             form_fields = grok.AutoFields(
    672                 IPGStudentClearance).omit('clearance_locked')
    673         else:
    674             form_fields = grok.AutoFields(
    675                 IUGStudentClearance).omit('clearance_locked')
     669            form_fields = grok.AutoFields(IPGStudentClearance)
     670        else:
     671            form_fields = grok.AutoFields(IUGStudentClearance)
    676672        if not getattr(self.context, 'officer_comment'):
    677673            form_fields = form_fields.omit('officer_comment')
     
    24132409        if self.context.is_postgrad:
    24142410            form_fields = grok.AutoFields(IPGStudentClearance).omit(
    2415                 'clearance_locked', 'clr_code', 'officer_comment')
     2411                'clr_code', 'officer_comment')
    24162412        else:
    24172413            form_fields = grok.AutoFields(IUGStudentClearance).omit(
    2418                 'clearance_locked', 'clr_code', 'officer_comment')
     2414                'clr_code', 'officer_comment')
    24192415        return form_fields
    24202416
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r13091 r13103  
    209209    personal_data_expired = Attribute('True if personal data expired')
    210210    transcript_enabled = Attribute('True if transcript processing is enabled')
     211    clearance_locked = Attribute('True if clearance form is locked')
    211212
    212213    password = Attribute('Encrypted password')
     
    309310    officer_comment = schema.Text(
    310311        title = _(u"Officer's Comment"),
    311         required = False,
    312         )
    313 
    314     clearance_locked = schema.Bool(
    315         title = _(u'Clearance form locked'),
    316         default = False,
    317312        required = False,
    318313        )
  • main/waeup.kofa/trunk/src/waeup/kofa/students/student.py

    r13080 r13103  
    239239        return True
    240240
     241    @property
     242    def clearance_locked(self):
     243        return self.state != CLEARANCE
     244
    241245    def transfer(self, certificate, current_session=None,
    242246        current_level=None, current_verdict=None, previous_verdict=None):
     
    324328    message.
    325329    """
    326     if student.state == CLEARANCE:
    327         student.clearance_locked = False
    328     else:
    329         student.clearance_locked = True
    330330    studycourse = createObject(u'waeup.StudentStudyCourse')
    331331    student['studycourse'] = studycourse
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r13001 r13103  
    224224        student.matric_number = u'234'
    225225        student.adm_code = u'my adm code'
    226         student.clearance_locked = False
    227226        student.clr_code = u'my clr code'
    228227        student.perm_address = u'Studentroad 21\nLagos 123456\n'
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r13091 r13103  
    18761876        self.browser.open(self.manage_clearance_path)
    18771877        self.assertFalse('Employer' in self.browser.contents)
    1878         self.student.clearance_locked = False
    18791878        self.browser.open(self.edit_clearance_path)
    18801879        self.assertFalse('Employer' in self.browser.contents)
     
    18881887        self.browser.open(self.manage_clearance_path)
    18891888        self.assertTrue('Employer' in self.browser.contents)
     1889        IWorkflowState(self.student).setState('clearance started')
    18901890        self.browser.open(self.edit_clearance_path)
    18911891        self.assertTrue('Employer' in self.browser.contents)
     
    26192619        self.browser.getControl(name="form.password").value = 'spwd'
    26202620        self.browser.getControl("Login").click()
    2621         self.student.clearance_locked = False
    26222621        self.browser.open(self.edit_clearance_path)
    26232622        self.browser.getControl(name="form.date_of_birth").value = '09/10/1961'
     
    34163415            self.browser.headers['content-disposition'])
    34173416        self.assertTrue(
    3418             'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
     3417            'adm_code,clr_code,date_of_birth,email,employer,'
    34193418            'firstname,lastname,matric_number,middlename,nationality,'
    34203419            'officer_comment,perm_address,personal_updated,phone,reg_number,'
     
    34223421            'password,state,history,certcode,is_postgrad,current_level,'
    34233422            'current_session\r\n'
    3424             ',1,,1981-02-04#,aa@aa.ng,,Anna,Tester,234,,,,,,'
     3423            ',,1981-02-04#,aa@aa.ng,,Anna,Tester,234,,,,,,'
    34253424            '1234#,123,m,K1000000,0,,,{SSHA}' in self.browser.contents)
    34263425
     
    35163515            self.browser.headers['content-disposition'])
    35173516        self.assertTrue(
    3518             'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
     3517            'adm_code,clr_code,date_of_birth,email,employer,'
    35193518            'firstname,lastname,matric_number,middlename,nationality,'
    35203519            'officer_comment,perm_address,personal_updated,phone,reg_number,'
     
    35223521            'password,state,history,certcode,is_postgrad,current_level,'
    35233522            'current_session\r\n'
    3524             ',1,,1981-02-04#,aa@aa.ng,,Anna,Tester,234,,,,,,'
     3523            ',,1981-02-04#,aa@aa.ng,,Anna,Tester,234,,,,,,'
    35253524            '1234#,123,m,K1000000,0,,,{SSHA}' in self.browser.contents)
    35263525        self.assertEqual(len(self.app['datacenter'].running_exports), 1)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r13012 r13103  
    125125
    126126    std_csv_entry = (
    127         'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
     127        'my adm code,my clr code,1981-02-04#,anna@sample.com,,'
    128128        'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",,'
    129129        '+234-123-12345#,123,f,A111111,0,,,,created'
     
    156156        result = open(self.outfile, 'rb').read()
    157157        self.assertTrue(
    158             'adm_code,clearance_locked,clr_code,date_of_birth,email,'
     158            'adm_code,clr_code,date_of_birth,email,'
    159159            'employer,firstname,lastname,matric_number,middlename,'
    160160            'nationality,officer_comment,perm_address,personal_updated,'
     
    162162            'transcript_comment,password,state,history,certcode,is_postgrad,'
    163163            'current_level,current_session\r\n'
    164             'my adm code,0,my clr code,'
     164            'my adm code,my clr code,'
    165165            '1981-02-04#,anna@sample.com,,Anna,Tester,234,M.,NG,,'
    166166            '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,123,f,'
     
    178178        result = open(self.outfile, 'rb').read()
    179179        self.assertTrue(
    180             'adm_code,clearance_locked,clr_code,date_of_birth,email,'
     180            'adm_code,clr_code,date_of_birth,email,'
    181181            'employer,firstname,lastname,matric_number,middlename,'
    182182            'nationality,officer_comment,perm_address,personal_updated,'
     
    184184            'transcript_comment,password,state,history,certcode,'
    185185            'is_postgrad,current_level,current_session\r\n'
    186             'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
     186            'my adm code,my clr code,1981-02-04#,anna@sample.com,,'
    187187            'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n"'
    188188            ',,+234-123-12345#,123,f,A111111,0,,,,created'
     
    198198        result = open(self.outfile, 'rb').read()
    199199        self.assertTrue(
    200             'adm_code,clearance_locked,clr_code,date_of_birth,email,'
     200            'adm_code,clr_code,date_of_birth,email,'
    201201            'employer,firstname,lastname,matric_number,middlename,'
    202202            'nationality,officer_comment,perm_address,personal_updated,'
     
    204204            'transcript_comment,password,state,history,certcode,'
    205205            'is_postgrad,current_level,current_session\r\n'
    206             'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
     206            'my adm code,my clr code,1981-02-04#,anna@sample.com,,'
    207207            'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n"'
    208208            ',,+234-123-12345#,123,f,A111111,0,,,,created'
  • main/waeup.kofa/trunk/src/waeup/kofa/students/workflow.py

    r10452 r13103  
    212212
    213213FORBIDDEN_POSTGRAD_TRANS = ['reset6', 'register_courses']
    214 LOCK_CLEARANCE_TRANS = ('reset2', 'request_clearance')
    215 UNLOCK_CLEARANCE_TRANS = ('reset3', 'reset4', 'start_clearance')
    216214
    217215registration_workflow = KofaWorkflow(REGISTRATION_TRANSITIONS)
     
    247245    history = IObjectHistory(obj)
    248246    history.addMessage(msg)
    249     if event.transition.transition_id in LOCK_CLEARANCE_TRANS:
    250         obj.clearance_locked = True
    251     if event.transition.transition_id in UNLOCK_CLEARANCE_TRANS:
    252         obj.clearance_locked = False
    253247    # School fee payment of returning students triggers the change of
    254248    # current session, current level, and current verdict
Note: See TracChangeset for help on using the changeset viewer.