Changeset 9814 for main/waeup.kofa
- Timestamp:
- 21 Dec 2012, 08:51:44 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py
r9797 r9814 631 631 ) 632 632 633 clearance_enabled = schema.Bool( 634 title = _(u'Clearance enabled'), 635 default = False, 636 ) 637 633 638 def getSessionString(): 634 639 """Returns the session string from the vocabulary. -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9813 r9814 126 126 yield value_dict 127 127 128 def clearance_disabled_message(student): 129 try: 130 session_config = grok.getSite()[ 131 'configuration'][str(student.current_session)] 132 except KeyError: 133 return _('Session configuration object is not available.') 134 if not session_config.clearance_enabled: 135 return _('Clearance is disabled for this session.') 136 return None 137 128 138 class StudentsBreadcrumb(Breadcrumb): 129 139 """A breadcrumb for the students container. … … 724 734 725 735 def update(self): 736 if clearance_disabled_message(self.context): 737 self.flash(clearance_disabled_message(self.context)) 738 self.redirect(self.url(self.context,'view_clearance')) 739 return 726 740 if self.context.state == REQUESTED: 727 741 IWorkflowInfo(self.context).fireTransition('clear') … … 744 758 form_fields = grok.AutoFields( 745 759 IUGStudentClearance).select('officer_comment') 760 761 def update(self): 762 if clearance_disabled_message(self.context): 763 self.flash(clearance_disabled_message(self.context)) 764 self.redirect(self.url(self.context,'view_clearance')) 765 return 766 return super(StudentRejectClearancePage, self).update() 746 767 747 768 @action(_('Save comment and reject clearance now'), style='primary') … … 771 792 return 772 793 773 #def render(self):774 # return775 794 776 795 class StudentPersonalDisplayFormPage(KofaDisplayFormPage): -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r9812 r9814 1267 1267 self.assertRaises( 1268 1268 Unauthorized, self.browser.open, other_student_path) 1269 # Clearance is disabled for this session 1270 self.browser.open(self.clearance_path) 1271 self.assertFalse('Clear student' in self.browser.contents) 1272 self.browser.open(self.student_path + '/clear') 1273 self.assertTrue('Clearance is disabled for this session' 1274 in self.browser.contents) 1275 self.app['configuration']['2004'].clearance_enabled = True 1269 1276 # Only in state clearance requested the CO does see the 'Clear' button 1270 1277 self.browser.open(self.clearance_path) -
main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py
r9521 r9814 35 35 VALIDATED) 36 36 from waeup.kofa.students.browser import ( 37 clearance_disabled_message, 37 38 StudentClearanceManageFormPage, 38 39 StudentBaseManageFormPage, StudentFilesUploadPage, … … 263 264 @property 264 265 def target_url(self): 266 if clearance_disabled_message(self.context): 267 return '' 265 268 if self.context.state != REQUESTED: 266 269 return '' … … 278 281 @property 279 282 def target_url(self): 283 if clearance_disabled_message(self.context): 284 return '' 280 285 if self.context.state not in (REQUESTED, CLEARED): 281 286 return ''
Note: See TracChangeset for help on using the changeset viewer.