Ignore:
Timestamp:
14 Jan 2020, 09:35:37 (5 years ago)
Author:
Henrik Bettermann
Message:

Change name of exporter classes.

Location:
main/waeup.kofa/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/docs/source/userdocs/datacenter/export.rst

    r15918 r15924  
    221221  .. automethod:: waeup.kofa.students.export.CourseTicketExporter.mangle_value()
    222222
    223 Student Outstanding Courses Exporter
    224 ------------------------------------
    225 
    226 .. autoclass:: waeup.kofa.students.export.StudentOutstandingCoursesExporter()
    227 
    228   .. autoattribute:: waeup.kofa.students.export.StudentOutstandingCoursesExporter.fields
    229   .. autoattribute:: waeup.kofa.students.export.StudentOutstandingCoursesExporter.title
    230   .. automethod:: waeup.kofa.students.export.StudentOutstandingCoursesExporter.mangle_value()
    231 
    232223Student Payment Exporter
    233224------------------------
     
    238229  .. autoattribute:: waeup.kofa.students.export.StudentPaymentExporter.title
    239230  .. automethod:: waeup.kofa.students.export.StudentPaymentExporter.mangle_value()
    240 
    241 Student Unpaid Payment Exporter
    242 -------------------------------
    243 
    244 .. autoclass:: waeup.kofa.students.export.StudentUnpaidPaymentExporter()
    245 
    246   .. autoattribute:: waeup.kofa.students.export.StudentUnpaidPaymentExporter.title
    247231
    248232Bed Ticket Exporter
     
    265249  postprocessing by the university.
    266250
     251Outstanding Courses Exporter
     252----------------------------
     253
     254.. autoclass:: waeup.kofa.students.export.OutstandingCoursesExporter()
     255
     256  .. autoattribute:: waeup.kofa.students.export.OutstandingCoursesExporter.fields
     257  .. autoattribute:: waeup.kofa.students.export.OutstandingCoursesExporter.title
     258  .. automethod:: waeup.kofa.students.export.OutstandingCoursesExporter.mangle_value()
     259
    267260Data For Bursary Exporter
    268261-------------------------
     
    273266  .. autoattribute:: waeup.kofa.students.export.DataForBursaryExporter.title
    274267  .. automethod:: waeup.kofa.students.export.DataForBursaryExporter.mangle_value()
     268
     269Unpaid Payments Exporter
     270------------------------
     271
     272.. autoclass:: waeup.kofa.students.export.UnpaidPaymentsExporter()
     273
     274  .. autoattribute:: waeup.kofa.students.export.UnpaidPaymentsExporter.title
    275275
    276276Accommodation Payments Exporter
     
    302302  .. automethod:: waeup.kofa.students.export.SessionPaymentsOverviewExporter.mangle_value()
    303303
    304 Student Study Levels Overview Exporter
    305 --------------------------------------
    306 
    307 .. autoclass:: waeup.kofa.students.export.StudentStudyLevelsOverviewExporter()
    308 
    309   .. autoattribute:: waeup.kofa.students.export.StudentStudyLevelsOverviewExporter.fields
    310   .. autoattribute:: waeup.kofa.students.export.StudentStudyLevelsOverviewExporter.title
    311   .. automethod:: waeup.kofa.students.export.StudentStudyLevelsOverviewExporter.mangle_value()
     304Study Levels Overview Exporter
     305------------------------------
     306
     307.. autoclass:: waeup.kofa.students.export.StudyLevelsOverviewExporter()
     308
     309  .. autoattribute:: waeup.kofa.students.export.StudyLevelsOverviewExporter.fields
     310  .. autoattribute:: waeup.kofa.students.export.StudyLevelsOverviewExporter.title
     311  .. automethod:: waeup.kofa.students.export.StudyLevelsOverviewExporter.mangle_value()
    312312
    313313Combo Card Data Exporter
     
    328328  .. autoattribute:: waeup.kofa.students.export.DataForLecturerExporter.title
    329329  .. automethod:: waeup.kofa.students.export.DataForLecturerExporter.mangle_value()
     330
     331Transcript Data Exporter
     332------------------------
     333
     334.. autoclass:: waeup.kofa.students.export.TranscriptDataExporter()
     335
     336  .. autoattribute:: waeup.kofa.students.export.TranscriptDataExporter.fields
     337  .. autoattribute:: waeup.kofa.students.export.TranscriptDataExporter.title
     338  .. automethod:: waeup.kofa.students.export.TranscriptDataExporter.mangle_value()
    330339
    331340File Export
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r15921 r15924  
    164164
    165165def get_payments(students, p_states=None, **kw):
    166     """Get all payments of `students` within given payment_date period.
     166    """Get all payment tickets of `students` within given payment_date period.
    167167    """
    168168    date_format = '%d/%m/%Y'
     
    196196
    197197def get_bedtickets(students):
    198     """Get all bedtickets of `students`.
     198    """Get all bed tickets of `students`.
    199199    """
    200200    tickets = []
     
    436436            value, name, context=context)
    437437
     438class StudentPaymentExporter(grok.GlobalUtility, StudentExporterBase):
     439    """The Student Payment Exporter first filters the set of students
     440    by searching the students catalog. Then it exports student payment
     441    tickets by iterating over the items of the student's ``payments``
     442    container. If the payment period is given, only tickets, which were
     443    paid in payment period, are considered for export.
     444    """
     445    grok.name('studentpayments')
     446
     447    fields = tuple(
     448        sorted(iface_names(
     449            IStudentOnlinePayment, exclude_attribs=False,
     450            omit=['display_item', 'certificate', 'student']))) + (
     451            'student_id','state','current_session')
     452    title = _(u'Student Payments (Data Backup)')
     453
     454    def filter_func(self, x, **kw):
     455        return get_payments(x, **kw)
     456
     457    def mangle_value(self, value, name, context=None):
     458        """The mangler determines the student's id, registration
     459        state and current session.
     460        """
     461        if context is not None:
     462            student = context.student
     463            if name in ['student_id','state',
     464                        'current_session'] and student is not None:
     465                value = getattr(student, name, None)
     466        return super(
     467            StudentPaymentExporter, self).mangle_value(
     468            value, name, context=context)
     469
    438470class DataForLecturerExporter(grok.GlobalUtility, StudentExporterBase):
    439471    """The Data for Lecturer Exporter searches for students in the course
     
    467499            value, name, context=context)
    468500
    469 class StudentOutstandingCoursesExporter(grok.GlobalUtility, StudentExporterBase):
     501class OutstandingCoursesExporter(grok.GlobalUtility, StudentExporterBase):
    470502    """The Student Outstanding Courses Exporter first filters the set of
    471503    students by searching the students catalog. Then it exports students with
     
    497529                value = context[3]
    498530        return super(
    499             StudentOutstandingCoursesExporter, self).mangle_value(
    500             value, name, context=context)
    501 
    502 class StudentPaymentExporter(grok.GlobalUtility, StudentExporterBase):
    503     """The Student Payment Exporter first filters the set of students
    504     by searching the students catalog. Then it exports student payment
    505     tickets by iterating over the items of the student's ``payments``
    506     container. If the payment period is given, only tickets, which were
    507     paid in payment period, are considered for export.
    508     """
    509     grok.name('studentpayments')
    510 
    511     fields = tuple(
    512         sorted(iface_names(
    513             IStudentOnlinePayment, exclude_attribs=False,
    514             omit=['display_item', 'certificate', 'student']))) + (
    515             'student_id','state','current_session')
    516     title = _(u'Student Payments (Data Backup)')
    517 
    518     def filter_func(self, x, **kw):
    519         return get_payments(x, **kw)
    520 
    521     def mangle_value(self, value, name, context=None):
    522         """The mangler determines the student's id, registration
    523         state and current session.
    524         """
    525         if context is not None:
    526             student = context.student
    527             if name in ['student_id','state',
    528                         'current_session'] and student is not None:
    529                 value = getattr(student, name, None)
    530         return super(
    531             StudentPaymentExporter, self).mangle_value(
    532             value, name, context=context)
    533 
    534 class StudentUnpaidPaymentExporter(StudentPaymentExporter):
    535     """The Student Unpaid Payment Exporter works just like the
    536     Student Payments Exporter but it exports only unpaid tickets.
    537     This exporter is designed for finding and finally purging outdated
    538     payment ticket.
     531            OutstandingCoursesExporter, self).mangle_value(
     532            value, name, context=context)
     533
     534class UnpaidPaymentsExporter(StudentPaymentExporter):
     535    """The Unpaid Payments Exporter works just like the
     536    Student Payment (singular intended) Exporter  but it exports only
     537    unpaid tickets. This exporter is designed for finding and finally
     538    purging outdated payment tickets.
    539539    """
    540540    grok.name('unpaidpayments')
     
    838838
    839839    def mangle_value(self, value, name, context=None):
    840         """The mangler determines the trascript data.
     840        """The mangler determines and formats the transcript data.
    841841        """
    842842        if name == 'transcript_data':
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r15921 r15924  
    3434    SchoolFeePaymentsOverviewExporter, StudyLevelsOverviewExporter,
    3535    ComboCardDataExporter, DataForBursaryExporter,
    36     StudentUnpaidPaymentExporter, SessionPaymentsOverviewExporter,
    37     StudentOutstandingCoursesExporter,
     36    UnpaidPaymentsExporter, SessionPaymentsOverviewExporter,
     37    OutstandingCoursesExporter,
    3838    AccommodationPaymentsExporter,
    3939    TranscriptDataExporter,
     
    797797        return
    798798
    799 class StudentOutstandingCoursesExporterTest(StudentImportExportSetup):
     799class OutstandingCoursesExporterTest(StudentImportExportSetup):
    800800
    801801    layer = FunctionalLayer
    802802
    803803    def setUp(self):
    804         super(StudentOutstandingCoursesExporterTest, self).setUp()
     804        super(OutstandingCoursesExporterTest, self).setUp()
    805805        self.setup_for_export()
    806806        return
     
    808808    def test_ifaces(self):
    809809        # make sure we fullfill interface contracts
    810         obj = StudentOutstandingCoursesExporter()
     810        obj = OutstandingCoursesExporter()
    811811        verifyObject(ICSVStudentExporter, obj)
    812         verifyClass(ICSVStudentExporter, StudentOutstandingCoursesExporter)
     812        verifyClass(ICSVStudentExporter, OutstandingCoursesExporter)
    813813        return
    814814
     
    831831        self.setup_student(self.student)
    832832        self.student['studycourse']['100']['C3'].score = 25
    833         exporter = StudentOutstandingCoursesExporter()
     833        exporter = OutstandingCoursesExporter()
    834834        exporter.export_all(self.app, self.outfile)
    835835        result = open(self.outfile, 'rb').read()
     
    10421042        return
    10431043
    1044 class StudentUnpaidPaymentExporterTest(StudentImportExportSetup):
     1044class UnpaidPaymentsExporterTest(StudentImportExportSetup):
    10451045
    10461046    layer = FunctionalLayer
    10471047
    10481048    def setUp(self):
    1049         super(StudentUnpaidPaymentExporterTest, self).setUp()
     1049        super(UnpaidPaymentsExporterTest, self).setUp()
    10501050        self.setup_for_export()
    10511051        return
     
    10551055        # set values we can expect in export file
    10561056        self.setup_student(self.student)
    1057         exporter = StudentUnpaidPaymentExporter()
     1057        exporter = UnpaidPaymentsExporter()
    10581058        exporter.export_all(self.app, self.outfile)
    10591059        result = open(self.outfile, 'rb').read()
Note: See TracChangeset for help on using the changeset viewer.