Changeset 11614 for main


Ignore:
Timestamp:
1 May 2014, 17:43:54 (11 years ago)
Author:
Henrik Bettermann
Message:

Use a mapping to map applicant data to student data. This can be more easily extended in custom packages.

File:
1 edited

Legend:

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

    r10845 r11614  
    5555    grok.provides(IApplicant)
    5656
    57     create_names = [
    58         'firstname', 'middlename', 'lastname',
    59         'sex', 'date_of_birth',
    60         'email', 'phone'
    61         ]
     57    applicant_student_mapping = (
     58        ('firstname', 'firstname'),
     59        ('middlename', 'middlename'),
     60        ('lastname', 'lastname'),
     61        ('sex', 'sex'),
     62        ('date_of_birth', 'date_of_birth'),
     63        ('email', 'email'),
     64        ('phone', 'phone'),
     65        )
    6266
    6367    def __init__(self):
     
    134138        # Set student attributes
    135139        try:
    136             for name in self.create_names:
    137                 setattr(student, name, getattr(self, name, None))
     140            for item in self.applicant_student_mapping:
     141                setattr(student, item[1], getattr(self, item[0], None))
    138142        except RequiredMissing, err:
    139143            return False, 'RequiredMissing: %s' % err
Note: See TracChangeset for help on using the changeset viewer.