Changeset 7388 for main


Ignore:
Timestamp:
19 Dec 2011, 07:59:24 (13 years ago)
Author:
uli
Message:

Copy over passport images when turning applicants into students.

File:
1 edited

Legend:

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

    r7376 r7388  
    3030from waeup.sirp.imagestorage import DefaultFileStoreHandler
    3131from waeup.sirp.interfaces import (
    32     IObjectHistory, IFileStoreHandler, IFileStoreNameChooser, ISIRPUtils)
     32    IObjectHistory, IFileStoreHandler, IFileStoreNameChooser, ISIRPUtils,
     33    IExtFileStore)
    3334from waeup.sirp.utils.helpers import attrs_to_fields, get_current_principal
    3435from waeup.sirp.applicants.interfaces import (
     
    108109        # Save the certificate
    109110        student['studycourse'].certificate = self.course_admitted
    110         # Copy passport image
     111        self._copyPassportImage(student)
    111112
    112113        # Save application slip (ExportPDFPage)
    113114
    114115        return True, 'Student %s created' % student.student_id
     116
     117    def _copyPassportImage(self, student):
     118        """Copy any passport image over to student location.
     119        """
     120        file_store = getUtility(IExtFileStore)
     121        appl_file = file_store.getFileByContext(self)
     122        stud_file_id = IFileStoreNameChooser(student).chooseName(
     123            attr="passport.jpg")
     124        file_store.createFile(stud_file_id, appl_file)
     125        return
    115126
    116127# Set all attributes of Applicant required in IApplicant as field
Note: See TracChangeset for help on using the changeset viewer.