Ignore:
Timestamp:
21 Apr 2021, 14:35:48 (4 years ago)
Author:
Henrik Bettermann
Message:

Adjust ApplicantOnlinePaymentProcessor.getMapping (2nd bugfix).

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

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r16470 r16472  
    55=======================
    66
    7 * No changes yet.
     7* Adjust `ApplicantOnlinePaymentProcessor.getMapping` (2nd bugfix).
    88
    991.7.1 (2021-04-20)
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/batching.py

    r16467 r16472  
    2121import grok
    2222from time import time
     23import unicodecsv
    2324from zope.schema import getFields
    2425from zope.interface import Interface
     
    363364    factory_name = 'waeup.ApplicantOnlinePayment'
    364365
    365     location_fields = ['applicant_id', 'p_id']
     366    location_fields = ['applicant_id',]
    366367
    367368    @property
     
    379380                "Need p_id for import in update and remove modes!")
    380381        return True
     382
     383    def getMapping(self, path, headerfields, mode):
     384        """Get a mapping from CSV file headerfields to actually used fieldnames.
     385
     386        """
     387        result = dict()
     388        reader = unicodecsv.reader(open(path, 'rb'))
     389        raw_header = reader.next()
     390        for num, field in enumerate(headerfields):
     391            if field not in  ['applicant_id', 'p_id'] and mode == 'remove':
     392                continue
     393            if field == u'--IGNORE--':
     394                continue
     395            result[raw_header[num]] = field
     396        return result
    381397
    382398    def parentsExist(self, row, site):
Note: See TracChangeset for help on using the changeset viewer.