Ignore:
Timestamp:
6 Jun 2024, 11:11:23 (5 months ago)
Author:
Henrik Bettermann
Message:

Use allowPortraitChange utility method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/utils.py

    r15651 r17811  
    1717##
    1818import grok
     19from zope.component import getUtility
     20from waeup.kofa.interfaces import IExtFileStore
    1921from waeup.kofa.students.utils import StudentsUtils
    2022from kofacustom.nigeria.interfaces import MessageFactory as _
     
    4143    # Maximum size of upload files in kB
    4244    MAX_KB = 250
     45
     46    def allowPortraitChange(self, student):
     47        """Check if student is allowed to change the portrait file.
     48        """
     49        # Passport pictures must not be editable if application slip
     50        # exists. Students are not allowed to change the picture if they passed
     51        # the regular Kofa application.
     52        slip = getUtility(IExtFileStore).getFileByContext(
     53            student, 'application_slip')
     54        if student.state not in self.PORTRAIT_CHANGE_STATES or slip is not None:
     55            return False
     56        return True
     57
Note: See TracChangeset for help on using the changeset viewer.