Changeset 16481 for main


Ignore:
Timestamp:
12 May 2021, 14:58:45 (4 years ago)
Author:
Henrik Bettermann
Message:

Save passport pictures of ase and pud applicants as passport2.jpg

File:
1 edited

Legend:

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

    r16229 r16481  
    1919import grok
    2020from zope.interface import implementedBy
     21from zope.component import getUtility
     22from waeup.kofa.interfaces import IExtFileStore
    2123from waeup.kofa.applicants.applicant import ApplicantFactory
    2224from waeup.kofa.utils.helpers import attrs_to_fields
     
    5961        return False
    6062
     63    def _copyPassportImage(self, student):
     64        """Copy any passport image over to student location.
     65        """
     66        file_store = getUtility(IExtFileStore)
     67        appl_file = file_store.getFileByContext(self)
     68        if appl_file is None:
     69            return
     70        fname = 'passport.jpg'
     71        # In Uniben we save JAMB pictures as passport2.jpg.
     72        if getattr(self.__parent__, 'prefix', None) in ('ase', 'pude'):
     73            fname = 'passport2.jpg'
     74        stud_file_id = IFileStoreNameChooser(student).chooseName(
     75            attr=fname)
     76        file_store.createFile(stud_file_id, appl_file)
     77        return
     78
    6179# Set all attributes of CustomApplicant required in ICustomApplicant as field
    6280# properties. Doing this, we do not have to set initial attributes
Note: See TracChangeset for help on using the changeset viewer.