Changeset 9936 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 7 Feb 2013, 08:21:05 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
r9933 r9936 34 34 'studentstudylevels', 'coursetickets', 35 35 'studentpayments', 'bedtickets', 'paymentsoverview', 36 'studylevelsoverview' )36 'studylevelsoverview', 'combocard') 37 37 38 38 def get_students(site, stud_filter=StudentsQuery()): … … 168 168 169 169 #: Fieldnames considered by this exporter 170 fields = tuple(sorted(iface_names( 171 IStudent, omit=['loggerInfo']))) + ( 170 fields = tuple(sorted(iface_names(IStudent))) + ( 172 171 'password', 'state', 'history', 'certcode', 'is_postgrad', 173 172 'current_level', 'current_session') … … 395 394 StudentsExporter, self).mangle_value( 396 395 value, name, context=context) 396 397 class ComboCardDataExporter(grok.GlobalUtility, StudentExporterBase): 398 """Exporter for Interswitch Combo Card Data. 399 """ 400 grok.name('combocard') 401 402 #: Fieldnames considered by this exporter 403 fields = ('display_fullname', 404 'matric_number', 405 'certificate', 'faculty', 'department') 406 407 #: The title under which this exporter will be displayed 408 title = _(u'Combo Card Data') 409 410 def mangle_value(self, value, name, context=None): 411 certificate = context['studycourse'].certificate 412 if name == 'certificate' and certificate is not None: 413 value = certificate.title 414 if name == 'department' and certificate is not None: 415 value = certificate.__parent__.__parent__.longtitle() 416 if name == 'faculty' and certificate is not None: 417 value = certificate.__parent__.__parent__.__parent__.longtitle() 418 return super( 419 ComboCardDataExporter, self).mangle_value( 420 value, name, context=context) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r9861 r9936 10 10 CourseTicketExporter, StudentPaymentsExporter, BedTicketsExporter, 11 11 StudentPaymentsOverviewExporter, StudentStudyLevelsOverviewExporter, 12 ComboCardDataExporter, 12 13 get_students,) 13 14 from waeup.kofa.students.accommodation import BedTicket … … 930 931 ) 931 932 return 933 934 class ComboCardExporterTest(StudentImportExportSetup): 935 936 layer = FunctionalLayer 937 938 def setUp(self): 939 super(ComboCardExporterTest, self).setUp() 940 self.setup_for_export() 941 return 942 943 def test_export_all(self): 944 self.setup_student(self.student) 945 exporter = ComboCardDataExporter() 946 exporter.export_all(self.app, self.outfile) 947 result = open(self.outfile, 'rb').read() 948 self.assertTrue( 949 'display_fullname,matric_number,certificate,faculty,department\r\n' 950 'Anna M. Tester,234,Unnamed Certificate,Faculty of Unnamed ' 951 'Faculty (NA),Department of Unnamed Department (NA)' 952 in result 953 ) 954 return
Note: See TracChangeset for help on using the changeset viewer.