Changeset 10613


Ignore:
Timestamp:
10 Sep 2013, 16:47:04 (11 years ago)
Author:
Henrik Bettermann
Message:

If certificate was given in import file but the parent container of an applicant doesn't exist , conversion checking exited with a traceback. We are now catching this error.

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

Legend:

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

    r10028 r10613  
    304304            # course1 application category must match container's.
    305305            parent = self.getParent(row, self.site)
    306             if cert.application_category != parent.application_category:
     306            if parent is None:
     307                errs.append(('container', 'not found'))
     308            elif cert.application_category != parent.application_category:
    307309                errs.append(('course1', 'wrong application category'))
    308310        if 'state' in row and \
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_faulty_applicant_data.csv

    r8612 r10613  
    335678,dp2011,1005,Jim,Knopf,1990-01-06,xx@yy.zz,CERT2,m,,
    446789,dp2011,1006,Lukas,Knopf,1990-01-07,xx@yy.zz,CERT3,m,,
     5,,8888,Mister,No,1990-01-07,no@yy.zz,CERT1,m,,
     6,dp2012,9999,Miss,Nobody,1990-01-07,nobody@yy.zz,CERT1,m,,
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_batching.py

    r9706 r10613  
    334334                    'Wrong birthdate of imported applicant '
    335335                    '(1990-01-02, should be: 1990-02-01)')
    336         self.assertEqual(num_warns,2)
     336        self.assertEqual(num_warns,4)
    337337        fail_contents = open(fail_file, 'rb').read()
    338338        # CERT2 is in wrong category ...
     
    340340        # ... and CERT3 does not exist.
    341341        self.assertTrue('course1: Invalid value' in fail_contents)
     342        # Conversion checking already fails because Mister or Miss No's
     343        # container does not exist.
     344        self.assertTrue('no@yy.zz,container: not found' in fail_contents)
     345        self.assertTrue('nobody@yy.zz,container: not found' in fail_contents)
    342346        shutil.rmtree(os.path.dirname(fail_file))
    343347        return
Note: See TracChangeset for help on using the changeset viewer.