Changeset 6769 for main/waeup.sirp/trunk
- Timestamp:
- 14 Sep 2011, 13:39:57 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6767 r6769 177 177 invalidate_accesscode(pin,comment) 178 178 IUserAccount(student).setPassword(self.ac_number) 179 student.adm_code = pin 179 180 self.flash('Password has been set. Your Student Id is %s' 180 181 % self.student_id) … … 668 669 # self.flash(self.dataNotComplete()) 669 670 # return 670 state = IWorkflowState(self.context).getState() 671 # This shouldn't happen, but the application officer 672 # might have forgotten to lock the form after changing the state 673 if state != CLEARANCE: 674 self.flash('This form cannot be submitted. Wrong state!') 675 return 676 IWorkflowInfo(self.context).fireTransition('request_clearance') 677 self.flash('Clearance has been requested.') 678 self.redirect(self.url(self.context)) 671 self.redirect(self.url(self.context,'request_clearance')) 679 672 return 680 673 … … 687 680 label = 'Start clearance' 688 681 ac_prefix = 'CLR' 689 pnav = 4 690 buttonname = 'Start' 682 notice = '' 683 pnav = 4 684 buttonname = 'Start clearance now' 691 685 692 686 def update(self, SUBMIT=None): … … 711 705 # expect an exception 712 706 invalidate_accesscode(pin,comment) 707 self.context.clr_code = pin 713 708 IWorkflowInfo(self.context).fireTransition('start_clearance') 714 709 self.flash('Clearance process is started.') 715 710 self.redirect(self.url(self.context,'cedit')) 716 711 return 712 713 class RequestClearance(WAeUPPage): 714 grok.context(IStudent) 715 grok.name('request_clearance') 716 grok.require('waeup.handleStudent') 717 grok.template('enterpin') 718 title = 'Request clearance' 719 label = 'Request clearance' 720 notice = 'Enter the CLR access code used for starting clearance.' 721 ac_prefix = 'CLR' 722 pnav = 4 723 buttonname = 'Request clearance now' 724 725 def update(self, SUBMIT=None): 726 self.ac_series = self.request.form.get('ac_series', None) 727 self.ac_number = self.request.form.get('ac_number', None) 728 if SUBMIT is None: 729 return 730 pin = '%s-%s-%s' % (self.ac_prefix, self.ac_series, self.ac_number) 731 if self.context.clr_code != pin: 732 self.flash("This isn't your CLR access code.") 733 return 734 state = IWorkflowState(self.context).getState() 735 # This shouldn't happen, but the application officer 736 # might have forgotten to lock the form after changing the state 737 if state != CLEARANCE: 738 self.flash('This form cannot be submitted. Wrong state!') 739 return 740 IWorkflowInfo(self.context).fireTransition('request_clearance') 741 self.flash('Clearance has been requested.') 742 self.redirect(self.url(self.context)) 743 return -
main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/enterpin.pt
r6759 r6769 11 11 value="" tal:attributes="value view/ac_series"/> - 12 12 <input name="ac_number" type="text" size="10" maxlength="10" 13 value="" tal:attributes="value view/ac_number" /></td> 13 value="" tal:attributes="value view/ac_number" /> 14 <font color="red"><span tal:replace="view/notice">Notice</span> 15 </font> 16 </td> 14 17 </tr> 15 18 <tr> 16 19 <td colspan="2"> 17 20 <input type="submit" name="SUBMIT" 18 tal:attributes="value view/buttonname" /> </td> 21 tal:attributes="value view/buttonname" /> 22 </td> 19 23 </tr> 20 24 </tbody> -
main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
r6764 r6769 91 91 state = Attribute('Returns the registration state of a student') 92 92 password = Attribute('Encrypted password of a student') 93 adm_code = Attribute('Admission checking access code')94 93 95 94 def loggerInfo(ob_class, comment): … … 122 121 ) 123 122 123 adm_code = schema.TextLine( 124 title = u'PWD access code', 125 default = u'', 126 required = False, 127 readonly = True, 128 ) 129 124 130 class IStudentClearance(IWAeUPObject): 125 131 """Representation of student clearance data. … … 136 142 ) 137 143 144 clr_code = schema.TextLine( 145 title = u'CLR access code', 146 default = u'', 147 required = False, 148 readonly = True, 149 ) 150 138 151 class IStudentPersonal(IWAeUPObject): 139 152 """Representation of student personal data. -
main/waeup.sirp/trunk/src/waeup/sirp/students/student.py
r6767 r6769 47 47 self.student_id = u'Z654321' 48 48 self.password = None 49 self.adm_code = None50 49 return 51 50 -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r6767 r6769 401 401 self.browser.getControl(name="ac_series").value = self.existing_clrseries 402 402 self.browser.getControl(name="ac_number").value = self.existing_clrnumber 403 self.browser.getControl("Start ").click()403 self.browser.getControl("Start clearance now").click() 404 404 self.assertMatches('...Clearance process is started...', 405 405 self.browser.contents) … … 411 411 self.browser.getLink("Edit").click() 412 412 self.browser.getControl("Save and request clearance").click() 413 self.browser.getControl(name="ac_series").value = self.existing_clrseries 414 self.browser.getControl(name="ac_number").value = self.existing_clrnumber 415 self.browser.getControl("Request clearance now").click() 413 416 self.assertMatches('...Clearance has been requested...', 414 417 self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.