Changeset 10233
- Timestamp:
- 27 May 2013, 07:14:13 (11 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
r10232 r10233 37 37 'studentstudylevels', 'coursetickets', 38 38 'studentpayments', 'bedtickets', 'paymentsoverview', 39 'studylevelsoverview', 'combocard' )39 'studylevelsoverview', 'combocard', 'bursary') 40 40 41 41 def get_students(site, stud_filter=StudentsQuery()): … … 314 314 value, name, context=context) 315 315 316 class DataForBursaryExporter(StudentPaymentsExporter): 317 """Exporter for OnlinePayment instances. 318 """ 319 grok.name('bursary') 320 321 #: Fieldnames considered by this exporter 322 fields = tuple( 323 sorted(iface_names( 324 IStudentOnlinePayment, exclude_attribs=False, 325 omit=['display_item']))) + ( 326 'student_id','matric_number','state','current_session', 327 'faccode', 'depcode', 'display_fullname') 328 329 #: The title under which this exporter will be displayed 330 title = _(u'Payment Data for Bursary') 331 332 def mangle_value(self, value, name, context=None): 333 """Treat location values special. 334 """ 335 if context is not None: 336 student = context.student 337 if name in ['student_id','matric_number', 338 'state','current_session', 339 'faccode','depcode', 340 'display_fullname'] and student is not None: 341 value = getattr(student, name, None) 342 return super( 343 StudentPaymentsExporter, self).mangle_value( 344 value, name, context=context) 345 316 346 class BedTicketsExporter(grok.GlobalUtility, StudentExporterBase): 317 347 """Exporter for BedTicket instances. -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r10232 r10233 13 13 CourseTicketExporter, StudentPaymentsExporter, BedTicketsExporter, 14 14 StudentPaymentsOverviewExporter, StudentStudyLevelsOverviewExporter, 15 ComboCardDataExporter, 15 ComboCardDataExporter, DataForBursaryExporter, 16 16 get_students,) 17 17 from waeup.kofa.students.accommodation import BedTicket … … 717 717 return 718 718 719 class BursaryDataExporterTest(StudentImportExportSetup): 720 721 layer = FunctionalLayer 722 723 def setUp(self): 724 super(BursaryDataExporterTest, self).setUp() 725 self.setup_for_export() 726 return 727 728 def test_export_all(self): 729 # we can really export all payments 730 # set values we can expect in export file 731 self.setup_student(self.student) 732 exporter = DataForBursaryExporter() 733 exporter.export_all(self.app, self.outfile) 734 result = open(self.outfile, 'rb').read() 735 self.assertEqual( 736 result, 737 'ac,amount_auth,creation_date,p_category,p_current,p_id,p_item,' 738 'p_level,p_session,p_state,payment_date,r_amount_approved,' 739 'r_code,r_desc,student_id,matric_number,state,current_session,' 740 'faccode,depcode,display_fullname\r\n' 741 742 '666,0.0,2012-04-01 13:12:01,schoolfee,1,my-id,p-item,100,2012,' 743 'unpaid,2012-04-01 14:12:01,12.12,r-code,,A111111,' 744 '234,created,2012,NA,NA,Anna M. Tester\r\n' 745 ) 746 return 747 719 748 class BedTicketsExporterTest(StudentImportExportSetup): 720 749
Note: See TracChangeset for help on using the changeset viewer.