[17780] | 1 | #!/usr/bin/env python2 |
---|
| 2 | # |
---|
| 3 | # $ ./bin/kofactl debug |
---|
[17786] | 4 | # >>> import sys; sys.path.append("."); import dumper; dumper.export_all(root) |
---|
[17780] | 5 | # |
---|
| 6 | |
---|
| 7 | import glob |
---|
| 8 | import os |
---|
| 9 | from zope.component.hooks import setSite |
---|
[17795] | 10 | |
---|
| 11 | from waeup.kofa.university.export import( |
---|
| 12 | FacultyExporter, |
---|
| 13 | DepartmentExporter, |
---|
| 14 | CourseExporter, |
---|
| 15 | CertificateExporter, |
---|
| 16 | CertificateCourseExporter, |
---|
| 17 | ) |
---|
[17780] | 18 | from waeup.kofa.students.export import ( |
---|
[17795] | 19 | FirstStudentStudyCourseExporter, |
---|
| 20 | SecondStudentStudyCourseExporter, |
---|
| 21 | FirstStudentStudyLevelExporter, |
---|
| 22 | SecondStudentStudyLevelExporter, |
---|
| 23 | FirstCourseTicketExporter, |
---|
| 24 | SecondCourseTicketExporter, |
---|
| 25 | BedTicketExporter, |
---|
| 26 | get_students,) |
---|
[17780] | 27 | from waeup.kofa.applicants.export import ( |
---|
[17788] | 28 | ApplicantsContainerExporter) |
---|
[17780] | 29 | from waeup.kofa.hostels.export import ( |
---|
| 30 | HostelExporter, |
---|
| 31 | BedExporter) |
---|
| 32 | from waeup.kofa.documents.export import ( |
---|
| 33 | PDFDocumentExporter, HTMLDocumentExporter, RESTDocumentExporter) |
---|
| 34 | from waeup.kofa.accesscodes.export import ( |
---|
| 35 | AccessCodeBatchExporter, AccessCodeExporter) |
---|
| 36 | from waeup.kofa.userscontainer import UserExporter |
---|
[17786] | 37 | from waeup.kofa.configuration import ConfigurationContainerExporter |
---|
[17780] | 38 | |
---|
| 39 | from waeup.uniben.applicants.export import ( |
---|
| 40 | CustomApplicantExporter, |
---|
| 41 | CustomApplicantPaymentExporter, |
---|
| 42 | ) |
---|
| 43 | from waeup.uniben.students.export import ( |
---|
| 44 | CustomStudentExporter, |
---|
| 45 | CustomStudentPaymentExporter, |
---|
| 46 | CustomStudentStudyCourseExporter, |
---|
| 47 | CustomStudentStudyLevelExporter, |
---|
| 48 | CustomCourseTicketExporter, |
---|
| 49 | ) |
---|
[17788] | 50 | try: |
---|
| 51 | from waeup.uniben.configuration import CustomSessionConfigurationExporter as SessionConfigurationExporter |
---|
| 52 | except: |
---|
| 53 | from waeup.kofa.configuration import SessionConfigurationExporter |
---|
[17780] | 54 | |
---|
[17788] | 55 | try: |
---|
| 56 | from waeup.uniben.applicants import CustomApplicantRefereeReportExporter as ApplicantRefereeReportExporter |
---|
| 57 | except: |
---|
| 58 | from waeup.kofa.applicants.export import ApplicantRefereeReportExporter |
---|
| 59 | |
---|
| 60 | try: |
---|
| 61 | from waeup.uniben.applicants import CustomApplicantPaymentExporter as ApplicantPaymentExporter |
---|
| 62 | except: |
---|
| 63 | from kofacustom.nigeria.applicants.export import NigeriaApplicantPaymentExporter as ApplicantPaymentExporter |
---|
| 64 | |
---|
| 65 | |
---|
[17780] | 66 | exporter_klasses = [ |
---|
| 67 | |
---|
| 68 | HostelExporter, |
---|
| 69 | BedExporter, |
---|
| 70 | PDFDocumentExporter, |
---|
| 71 | HTMLDocumentExporter, |
---|
| 72 | RESTDocumentExporter, |
---|
| 73 | AccessCodeBatchExporter, |
---|
| 74 | AccessCodeExporter, |
---|
[17788] | 75 | SessionConfigurationExporter, |
---|
[17780] | 76 | UserExporter, |
---|
[17786] | 77 | ConfigurationContainerExporter, |
---|
[17780] | 78 | |
---|
[17795] | 79 | FacultyExporter, |
---|
| 80 | DepartmentExporter, |
---|
| 81 | CourseExporter, |
---|
| 82 | CertificateExporter, |
---|
| 83 | CertificateCourseExporter, |
---|
| 84 | |
---|
[17780] | 85 | ApplicantsContainerExporter, |
---|
| 86 | CustomApplicantExporter, |
---|
[17788] | 87 | ApplicantPaymentExporter, |
---|
[17780] | 88 | ApplicantRefereeReportExporter, |
---|
| 89 | |
---|
| 90 | CustomStudentExporter, |
---|
| 91 | CustomStudentPaymentExporter, |
---|
| 92 | CustomStudentStudyCourseExporter, |
---|
| 93 | CustomStudentStudyLevelExporter, |
---|
| 94 | CustomCourseTicketExporter, |
---|
| 95 | BedTicketExporter, |
---|
| 96 | |
---|
| 97 | FirstStudentStudyCourseExporter, |
---|
| 98 | SecondStudentStudyCourseExporter, |
---|
| 99 | FirstStudentStudyLevelExporter, |
---|
| 100 | SecondStudentStudyLevelExporter, |
---|
| 101 | FirstCourseTicketExporter, |
---|
| 102 | SecondCourseTicketExporter, |
---|
| 103 | ] |
---|
| 104 | |
---|
[17795] | 105 | exporter_klasses = [ |
---|
| 106 | FacultyExporter, |
---|
| 107 | DepartmentExporter, |
---|
| 108 | CourseExporter, |
---|
| 109 | CertificateExporter, |
---|
| 110 | CertificateCourseExporter, |
---|
| 111 | ] |
---|
[17788] | 112 | |
---|
[17780] | 113 | def export_all(root): |
---|
| 114 | site = root["uniben"] |
---|
| 115 | setSite(site) |
---|
| 116 | for klass in exporter_klasses: |
---|
| 117 | c_name = "export_" + getattr(klass, "grokcore.component.directive.name") |
---|
| 118 | print(c_name) |
---|
| 119 | outfile = "csvdata/%s.csv" % c_name |
---|
| 120 | exporter = klass() |
---|
| 121 | print("Dump data to %s..." % outfile) |
---|
| 122 | exporter.export_all(site, outfile) |
---|
| 123 | #try: |
---|
| 124 | # exporter.export_all(site, outfile) |
---|
| 125 | #except: |
---|
| 126 | # print("CRASHED: " + c_name) |
---|
| 127 | # if outfile in glob.glob("csvdata/*.csv"): |
---|
| 128 | # os.remove(outfile) |
---|
| 129 | |
---|
| 130 | |
---|