Changeset 6719 for main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
- Timestamp:
- 12 Sep 2011, 10:49:11 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6718 r6719 578 578 return 579 579 580 class StudentClearanceStartActionButton(ManageActionButton): 581 grok.order(1) 582 grok.context(IStudent) 583 grok.view(StudentClearanceDisplayFormPage) 584 grok.require('waeup.handleStudent') 585 icon = 'actionicon_start.png' 586 text = 'Start clearance' 587 target = 'start_clearance' 588 589 @property 590 def target_url(self): 591 if self.context.state != 'admitted': 592 return '' 593 return self.view.url(self.view.context, self.target) 594 580 595 class StudentClearanceEditActionButton(ManageActionButton): 581 596 grok.order(1) … … 616 631 datepicker.need() 617 632 return super(StudentClearanceEditFormPage, self).update() 633 634 class StartClearance(WAeUPPage): 635 grok.context(IStudent) 636 grok.name('start_clearance') 637 grok.require('waeup.handleStudent') 638 grok.template('enterpin') 639 title = 'Start clearance' 640 label = 'Start clearance' 641 acprefix = 'CLR' 642 pnav = 4 643 buttonname = 'Start' 644 645 646 def update(self, SUBMIT=None): 647 # We must not use form.ac_series and form.ac_number in forms since these 648 # are interpreted as applicant credentials in the applicants package 649 self.acseries = self.request.form.get('form.acseries', None) 650 self.acnumber = self.request.form.get('form.acnumber', None) 651 652 if SUBMIT is None: 653 return 654 pin = '%s-%s-%s' % (self.acprefix,self.acseries,self.acnumber) 655 code = get_access_code(pin) 656 if not code: 657 self.flash('Access code is invalid.') 658 return 659 # Mark pin as used (this also fires a pin related transition) 660 # and fire transition start_clearance 661 if code.state == USED: 662 self.flash('Access code has already been used.') 663 return 664 else: 665 comment = u"AC invalidated for %s" % self.context.student_id 666 # Here we know that the ac is in state initialized so we do not 667 # expect an exception 668 invalidate_accesscode(pin,comment) 669 670 self.flash('Clearance process is started.') 671 return
Note: See TracChangeset for help on using the changeset viewer.