Ignore:
Timestamp:
6 Sep 2024, 14:11:04 (4 months ago)
Author:
Henrik Bettermann
Message:

Add exporter.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/students/export.py

    r17905 r17915  
    192192            MedicalHistoryExporter, self).mangle_value(
    193193            value, name, context=context)
     194
     195def get_routingslip_exists(students, **kw):
     196    """Get students with outstanding certificate courses.
     197    """
     198    students_with_slip = []
     199    for student in students:
     200        file_id = IFileStoreNameChooser(student).chooseName(
     201            attr='routingslip.pdf')
     202        os_path = getUtility(IExtFileStore)._pathFromFileID(file_id)
     203        if os.path.exists(os_path):
     204            students_with_slip.append(student)
     205    return students_with_slip
     206
     207class RoutingSlipExporter(grok.GlobalUtility, StudentExporterBase):
     208    """
     209    """
     210    grok.name('routingslip')
     211
     212    fields = ('student_id',)
     213    title = 'Routing Slip Exists'
     214
     215    def filter_func(self, x, **kw):
     216        return get_routingslip_exists(x, **kw)
     217
     218    #def mangle_value(self, value, name, context=None):
     219    #    if name == 'routing_slip':
     220    #        file_id = IFileStoreNameChooser(context).chooseName(
     221    #            attr='routingslip.pdf')
     222    #        os_path = getUtility(IExtFileStore)._pathFromFileID(file_id)
     223    #        if not os.path.exists(os_path):
     224    #            value = None
     225    #        else:
     226    #            value = '1'
     227    #    return super(
     228    #        RoutingSlipExporter, self).mangle_value(
     229    #        value, name, context=context)
    194230
    195231
  • main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py

    r17912 r17915  
    877877            'trimmedpayments',
    878878            'medicalhistory',
     879            'routingslip',
    879880            'nysc',
    880881            )
Note: See TracChangeset for help on using the changeset viewer.