Changeset 13766
- Timestamp:
- 8 Mar 2016, 06:22:12 (9 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/CHANGES.txt
r13745 r13766 4 4 1.4.2.dev0 (unreleased) 5 5 ======================= 6 7 * Create new exporter for lecturers and further restrict the usage of 8 exporters at course level. 6 9 7 10 * Show certificate-specific p_level value on payment pages. -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r13764 r13766 3422 3422 3423 3423 def _set_exporter_values(self): 3424 # We provide only t wo exporters.3424 # We provide only the 'lecturer' exporter but can add more. 3425 3425 exporters = [] 3426 for name in (' students', 'coursetickets'):3426 for name in ('lecturer',): 3427 3427 util = getUtility(ICSVExporter, name=name) 3428 3428 exporters.append((util.title, name),) 3429 3429 self.exporters = exporters 3430 3431 def _set_session_values(self): 3432 # We allow only current academic session 3433 academic_session = grok.getSite()['configuration'].current_academic_session 3434 if not academic_session: 3435 self.sessions = [] 3436 return 3437 x = academic_sessions_vocab.getTerm(academic_session) 3438 self.sessions = [(x.title, x.token)] 3439 return 3430 3440 3431 3441 def update(self, START=None, session=None, level=None, mode=None, … … 3435 3445 self._set_mode_values() 3436 3446 self._set_exporter_values() 3447 if not self.sessions: 3448 self.flash( 3449 _('Academic session not set. ' 3450 'Please contact the administrator.'), 3451 type='danger') 3452 self.redirect(self.url(self.context)) 3453 return 3437 3454 if START is None: 3438 3455 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
r13736 r13766 349 349 value, name, context=context) 350 350 351 class DataForLecturerExporter(CourseTicketExporter): 352 """ 353 """ 354 grok.name('lecturer') 355 356 fields = ('matric_number', 'reg_number', 'student_id', 'display_fullname', 357 'level', 'code', 'level_session', 'score') 358 359 title = _(u'Data for Lecturer') 360 361 def mangle_value(self, value, name, context=None): 362 """The mangler determines the student's id and fullname. 363 """ 364 if context is not None: 365 student = context.student 366 if name in ('student_id', 'fullname') and student is not None: 367 value = getattr(student, name, None) 368 return super( 369 CourseTicketExporter, self).mangle_value( 370 value, name, context=context) 351 371 352 372 class StudentPaymentExporter(grok.GlobalUtility, StudentExporterBase): -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r13764 r13766 3755 3755 ) 3756 3756 3757 def test_course_export_students(self):3757 def deprecated_test_course_export_students(self): 3758 3758 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 3759 3759 course1_path = 'http://localhost/app/faculties/fac1/dep1/courses/COURSE1' … … 3801 3801 ) 3802 3802 3803 def test_course_export_ coursetickets(self):3803 def test_course_export_lecturer(self): 3804 3804 # We add study level 100 to the student's studycourse 3805 3805 studylevel = StudentStudyLevel() … … 3813 3813 self.browser.getLink("Export student data").click() 3814 3814 self.browser.getControl("Configure new export").click() 3815 self.browser.getControl(name="exporter").value = ['coursetickets'] 3815 self.assertTrue( 3816 'Academic session not set. Please contact the administrator.' 3817 in self.browser.contents) 3818 self.app['configuration'].current_academic_session = 2004 3819 self.browser.getControl("Configure new export").click() 3820 self.browser.getControl(name="exporter").value = ['lecturer'] 3816 3821 self.browser.getControl(name="session").value = ['2004'] 3817 3822 self.browser.getControl(name="level").value = ['100'] … … 3825 3830 'text/csv; charset=UTF-8') 3826 3831 self.assertTrue( 3827 'filename="WAeUP.Kofa_ coursetickets_%s.csv' % job_id in3832 'filename="WAeUP.Kofa_lecturer_%s.csv' % job_id in 3828 3833 self.browser.headers['content-disposition']) 3829 3834 # ... and contains the course ticket COURSE1 3830 3835 self.assertEqual(self.browser.contents, 3831 'automatic,carry_over,code,credits,dcode,fcode,level,' 3832 'level_session,mandatory,passmark,score,semester,title,' 3833 'student_id,certcode,display_fullname\r\n1,0,COURSE1,10,' 3834 'dep1,fac1,100,2004,1,40,,1,' 3835 'Unnamed Course,K1000000,CERT1,Anna Tester\r\n') 3836 3836 'matric_number,reg_number,student_id,display_fullname,level,code,' 3837 'level_session,score\r\n,,K1000000,,100,COURSE1,2004,\r\n') 3837 3838 self.assertEqual(len(self.app['datacenter'].running_exports), 1) 3838 3839 job_id = self.app['datacenter'].running_exports[0][0] … … 3847 3848 self.assertTrue( 3848 3849 'zope.mgr - students.browser.CourseExportJobContainerJobConfig ' 3849 '- exported: coursetickets(2004, 100, COURSE1), job_id=%s'3850 '- exported: lecturer (2004, 100, COURSE1), job_id=%s' 3850 3851 % job_id in logcontent 3851 3852 ) 3852 3853 self.assertTrue( 3853 3854 'zope.mgr - students.browser.ExportJobContainerDownload ' 3854 '- downloaded: WAeUP.Kofa_ coursetickets_%s.csv, job_id=%s'3855 '- downloaded: WAeUP.Kofa_lecturer_%s.csv, job_id=%s' 3855 3856 % (job_id, job_id) in logcontent 3856 3857 )
Note: See TracChangeset for help on using the changeset viewer.