Changeset 11069 for main/waeup.uniben/trunk
- Timestamp:
- 11 Feb 2014, 07:49:25 (11 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/locales/en/LC_MESSAGES/waeup.kofa.po
r10391 r11069 1 1 msgid "" 2 2 msgstr "" 3 "<strong>WARNING: </strong> Do not use these exporters between 8 am and 8 pm. Uniben student data exports take longer than 30 minutes. During exports applicants or students won't be able to register.\n"4 3 "Project-Id-Version: \n" 5 4 "POT-Creation-Date: \n" -
main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
r10481 r11069 21 21 from zope.component import getUtility 22 22 from hurry.workflow.interfaces import IWorkflowInfo 23 from waeup.kofa.interfaces import REQUESTED, IExtFileStore, IKofaUtils 23 from waeup.kofa.interfaces import ( 24 REQUESTED, IExtFileStore, IKofaUtils, IObjectHistory) 24 25 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget 25 from waeup.kofa.browser.layout import KofaEditFormPage 26 from waeup.kofa.browser.layout import action, jsaction 26 from waeup.kofa.browser.layout import action, jsaction, KofaEditFormPage 27 27 from waeup.kofa.students.browser import ( 28 28 StudyLevelEditFormPage, StudyLevelDisplayFormPage, 29 29 StudentBasePDFFormPage, ExportPDFCourseRegistrationSlipPage, 30 30 CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage, 31 msave, emit_lock_message) 31 msave, emit_lock_message, 32 StudentActivatePage, StudentDeactivatePage) 32 33 from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket 33 34 from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS … … 278 279 """ 279 280 form_fields = grok.AutoFields(ICourseTicket).omit('score') 281 282 class CustomStudentActivatePage(StudentActivatePage): 283 """ Activate student account 284 """ 285 286 def update(self): 287 self.context.suspended = False 288 self.context.writeLogMessage(self, 'account activated') 289 history = IObjectHistory(self.context) 290 history.addMessage('Student account activated', user='undisclosed') 291 self.flash(_('Student account has been activated.')) 292 self.redirect(self.url(self.context)) 293 return 294 295 class CustomStudentDeactivatePage(StudentDeactivatePage): 296 """ Deactivate student account 297 """ 298 def update(self): 299 self.context.suspended = True 300 self.context.writeLogMessage(self, 'account deactivated') 301 history = IObjectHistory(self.context) 302 history.addMessage('Student account deactivated', user='undisclosed') 303 self.flash(_('Student account has been deactivated.')) 304 self.redirect(self.url(self.context)) 305 return -
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r10902 r11069 711 711 self.browser.contents) 712 712 self.student.suspended = False 713 714 def test_activate_deactivate_buttons(self): 715 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 716 self.browser.open(self.student_path) 717 self.browser.getLink("Deactivate").click() 718 self.assertTrue( 719 'Student account has been deactivated.' in self.browser.contents) 720 self.assertTrue( 721 'Base Data (account deactivated)' in self.browser.contents) 722 self.assertTrue(self.student.suspended) 723 self.browser.getLink("Activate").click() 724 self.assertTrue( 725 'Student account has been activated.' in self.browser.contents) 726 self.assertFalse( 727 'Base Data (account deactivated)' in self.browser.contents) 728 self.assertFalse(self.student.suspended) 729 # History messages have been added ... 730 self.browser.getLink("History").click() 731 # User is undisclosed 732 self.assertTrue( 733 'Student account deactivated<br />' in self.browser.contents) 734 self.assertTrue( 735 'Student account activated<br />' in self.browser.contents) 736 # ... and actions have been logged. 737 logfile = os.path.join( 738 self.app['datacenter'].storage, 'logs', 'students.log') 739 logcontent = open(logfile).read() 740 self.assertTrue('zope.mgr - waeup.uniben.students.browser.CustomStudentDeactivatePage - ' 741 'B1000000 - account deactivated' in logcontent) 742 self.assertTrue('zope.mgr - waeup.uniben.students.browser.CustomStudentActivatePage - ' 743 'B1000000 - account activated' in logcontent)
Note: See TracChangeset for help on using the changeset viewer.