Changeset 12079 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 28 Nov 2014, 08:50:17 (10 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/export.py
r10654 r12079 63 63 return self.export(containers.values(), filepath) 64 64 65 class Applicant sExporter(grok.GlobalUtility, ExporterBase):65 class ApplicantExporter(grok.GlobalUtility, ExporterBase): 66 66 """Exporter for Applicants. 67 67 """ … … 88 88 value = str('%s#' % value) 89 89 return super( 90 Applicant sExporter, self).mangle_value(90 ApplicantExporter, self).mangle_value( 91 91 value, name, context=context) 92 92 -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py
r11869 r12079 11 11 from waeup.kofa.applicants import ApplicantsContainer 12 12 from waeup.kofa.applicants.export import ( 13 ApplicantsContainerExporter, Applicant sExporter)13 ApplicantsContainerExporter, ApplicantExporter) 14 14 from waeup.kofa.applicants.interfaces import ( 15 15 AppCatSource, ApplicationTypeSource) … … 81 81 return 82 82 83 class Applicant sExporterTest(ApplicantImportExportSetup):83 class ApplicantExporterTest(ApplicantImportExportSetup): 84 84 85 85 layer = FunctionalLayer 86 86 87 87 def setUp(self): 88 super(Applicant sExporterTest, self).setUp()88 super(ApplicantExporterTest, self).setUp() 89 89 self.outfile = os.path.join(self.workdir, 'myoutput.csv') 90 90 self.cat = getUtility(ICatalog, name='applicants_catalog') … … 94 94 def test_ifaces(self): 95 95 # make sure we fullfill interface contracts 96 obj = Applicant sExporter()96 obj = ApplicantExporter() 97 97 verifyObject(ICSVExporter, obj) 98 verifyClass(ICSVExporter, Applicant sExporter)98 verifyClass(ICSVExporter, ApplicantExporter) 99 99 return 100 100 … … 132 132 # we can export nearly empty applicants 133 133 self.applicant.applicant_id = u'dp2011_654321' 134 exporter = Applicant sExporter()134 exporter = ApplicantExporter() 135 135 exporter.export([self.applicant], self.outfile) 136 136 result = open(self.outfile, 'rb').read() … … 156 156 # set values we can expect in export file 157 157 applicant = self.setup_applicant(self.applicant) 158 exporter = Applicant sExporter()158 exporter = ApplicantExporter() 159 159 exporter.export([applicant], self.outfile) 160 160 result = open(self.outfile, 'rb').read() … … 183 183 # set values we can expect in export file 184 184 self.applicant = self.setup_applicant(self.applicant) 185 exporter = Applicant sExporter()185 exporter = ApplicantExporter() 186 186 exporter.export_all(self.app, self.outfile) 187 187 result = open(self.outfile, 'rb').read() … … 204 204 def test_export_filtered(self): 205 205 self.applicant = self.setup_applicant(self.applicant) 206 exporter = Applicant sExporter()206 exporter = ApplicantExporter() 207 207 exporter.export_filtered( 208 208 self.app, self.outfile, container=self.container.code) -
main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
r11757 r12079 226 226 227 227 228 class Student sExporter(grok.GlobalUtility, StudentExporterBase):228 class StudentExporter(grok.GlobalUtility, StudentExporterBase): 229 229 """Exporter for Students. 230 230 """ … … 247 247 value = str('%s#' % value) 248 248 return super( 249 Student sExporter, self).mangle_value(249 StudentExporter, self).mangle_value( 250 250 value, name, context=context) 251 251 … … 438 438 value, name, context=context) 439 439 440 class StudentPaymentsOverviewExporter(Student sExporter):440 class StudentPaymentsOverviewExporter(StudentExporter): 441 441 """Exporter for students with payment overview. 442 442 """ … … 470 470 value = '' 471 471 return super( 472 Student sExporter, self).mangle_value(473 value, name, context=context) 474 475 class StudentStudyLevelsOverviewExporter(Student sExporter):472 StudentExporter, self).mangle_value( 473 value, name, context=context) 474 475 class StudentStudyLevelsOverviewExporter(StudentExporter): 476 476 """Exporter for students with study level overview. 477 477 """ … … 502 502 break 503 503 return super( 504 Student sExporter, self).mangle_value(504 StudentExporter, self).mangle_value( 505 505 value, name, context=context) 506 506 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r11756 r12079 10 10 from waeup.kofa.students.catalog import StudentsQuery 11 11 from waeup.kofa.students.export import ( 12 Student sExporter, StudentStudyCourseExporter, StudentStudyLevelExporter,12 StudentExporter, StudentStudyCourseExporter, StudentStudyLevelExporter, 13 13 CourseTicketExporter, StudentPaymentsExporter, BedTicketsExporter, 14 14 StudentPaymentsOverviewExporter, StudentStudyLevelsOverviewExporter, … … 101 101 102 102 103 class Student sExporterTest(StudentImportExportSetup):103 class StudentExporterTest(StudentImportExportSetup): 104 104 105 105 layer = FunctionalLayer … … 112 112 113 113 def setUp(self): 114 super(Student sExporterTest, self).setUp()114 super(StudentExporterTest, self).setUp() 115 115 self.setup_for_export() 116 116 return … … 118 118 def test_ifaces(self): 119 119 # make sure we fullfill interface contracts 120 obj = Student sExporter()120 obj = StudentExporter() 121 121 verifyObject(ICSVStudentExporter, obj) 122 verifyClass(ICSVStudentExporter, Student sExporter)122 verifyClass(ICSVStudentExporter, StudentExporter) 123 123 return 124 124 … … 133 133 # set values we can expect in export file 134 134 self.setup_student(self.student) 135 exporter = Student sExporter()135 exporter = StudentExporter() 136 136 exporter.export([self.student], self.outfile) 137 137 result = open(self.outfile, 'rb').read() … … 155 155 # set values we can expect in export file 156 156 self.setup_student(self.student) 157 exporter = Student sExporter()157 exporter = StudentExporter() 158 158 exporter.export_all(self.app, self.outfile) 159 159 result = open(self.outfile, 'rb').read() … … 175 175 # we can export a single student 176 176 self.setup_student(self.student) 177 exporter = Student sExporter()177 exporter = StudentExporter() 178 178 exporter.export_student(self.student, self.outfile) 179 179 result = open(self.outfile, 'rb').read() … … 197 197 self.app['students'].addStudent(self.student) 198 198 notify(grok.ObjectModifiedEvent(self.student)) 199 exporter = Student sExporter()199 exporter = StudentExporter() 200 200 201 201 exporter.export_filtered( … … 249 249 self.app['students'].addStudent(self.student) 250 250 notify(grok.ObjectModifiedEvent(self.student)) 251 exporter = Student sExporter()251 exporter = StudentExporter() 252 252 # current_session can be both a string ... 253 253 exporter.export_filtered( … … 269 269 self.app['students'].addStudent(self.student) 270 270 notify(grok.ObjectModifiedEvent(self.student)) 271 exporter = Student sExporter()271 exporter = StudentExporter() 272 272 273 273 exporter.export_filtered( -
main/waeup.kofa/trunk/src/waeup/kofa/userscontainer.py
r10648 r12079 66 66 67 67 68 class User sExporter(grok.GlobalUtility, ExporterBase):68 class UserExporter(grok.GlobalUtility, ExporterBase): 69 69 """Exporter for user accounts. 70 70 """ … … 98 98 value[role] = object_list 99 99 return super( 100 User sExporter, self).mangle_value(100 UserExporter, self).mangle_value( 101 101 value, name, context=context) 102 102 -
main/waeup.kofa/trunk/src/waeup/kofa/userscontainer.txt
r9283 r12079 50 50 We can export user accounts: 51 51 52 >>> from waeup.kofa.userscontainer import User sExporter52 >>> from waeup.kofa.userscontainer import UserExporter 53 53 >>> import os 54 54 >>> import tempfile 55 55 >>> workdir = tempfile.mkdtemp() 56 56 >>> outfile = os.path.join(workdir, 'myoutput.csv') 57 >>> exporter = User sExporter()57 >>> exporter = UserExporter() 58 58 >>> site = {'users':myusers} 59 59 >>> exporter.export_all(site, outfile)
Note: See TracChangeset for help on using the changeset viewer.