Changeset 7924


Ignore:
Timestamp:
20 Mar 2012, 01:21:06 (13 years ago)
Author:
uli
Message:

First more or less working version of applicants exporter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/export.py

    r7914 r7924  
    7373
    7474    #: Fieldnames considered by this exporter
    75     fields = tuple(IApplicantBaseData.names())
     75    fields = tuple(sorted(IApplicantBaseData.names()))
    7676
    7777    #: The title under which this exporter will be displayed
    7878    title = _(u'Applicants')
    7979
    80     def NOmangle_value(self, value, name, context=None):
    81         if name == 'provider' and isinstance(value, tuple):
    82             value = value[0]
     80    def mangle_value(self, value, name, context=None):
     81        if name in (
     82            'course1', 'course2', 'course_admitted') and value is not None:
     83            value = value.code
     84        elif name == 'school_grades':
     85            value = [eval(entry.to_string()) for entry in value]
    8386        return super(
    84             ApplicantsContainerExporter, self).mangle_value(
     87            ApplicantsExporter, self).mangle_value(
    8588            value, name, context=context)
    8689
     
    105108            return self.export([], filepath)
    106109        applicants = catalog.searchResults(
    107             reg_number=(None, None))
     110            # reg_num might not be set and then would not be found.
     111            # We therefore search for applicant_id.
     112            applicant_id=(None, None))
    108113        return self.export(applicants, filepath)
Note: See TracChangeset for help on using the changeset viewer.