Changeset 15513


Ignore:
Timestamp:
24 Jul 2019, 20:33:11 (5 years ago)
Author:
Henrik Bettermann
Message:

Extend ApplicantPaymentExporter?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/applicants/export.py

    r15186 r15513  
    1919"""
    2020import grok
    21 from waeup.kofa.applicants.interfaces import IApplicantBaseData
     21from waeup.kofa.applicants.interfaces import (
     22    IApplicantBaseData, IApplicantOnlinePayment)
    2223from waeup.kofa.utils.helpers import iface_names
     24from waeup.kofa.applicants.export import ApplicantPaymentExporter
    2325from kofacustom.nigeria.applicants.export import NigeriaApplicantExporter
    2426from kofacustom.nigeria.applicants.interfaces import (
     
    4143        'password', 'state', 'history', 'container_code', 'application_number',
    4244        'display_fullname', 'application_date')
     45
     46class CustomApplicantPaymentExporter(ApplicantPaymentExporter):
     47    """
     48    """
     49    fields = tuple(sorted(iface_names(
     50        IApplicantOnlinePayment,
     51        exclude_attribs=False,
     52        omit=['display_item']))) + (
     53              'applicant_id',
     54              'reg_number',
     55              'display_fullname',
     56              'course1',
     57              'course2')
     58
     59    def mangle_value(self, value, name, context=None):
     60        """
     61        """
     62        if name in ('applicant_id', 'reg_number',
     63            'display_fullname', 'course1', 'course2') and context is not None:
     64            applicant = context.__parent__
     65            value = getattr(applicant, name, None)
     66        return super(
     67            CustomApplicantPaymentExporter, self).mangle_value(
     68            value, name, context=context)
Note: See TracChangeset for help on using the changeset viewer.