Ignore:
Timestamp:
7 Oct 2021, 11:06:40 (3 years ago)
Author:
Henrik Bettermann
Message:

Ease customization of portrait upload conditions.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r16609 r16671  
    29352935
    29362936    def update(self):
    2937         PORTRAIT_CHANGE_STATES = getUtility(IStudentsUtils).PORTRAIT_CHANGE_STATES
    2938         if self.context.student.state not in PORTRAIT_CHANGE_STATES:
     2937        if not getUtility(IStudentsUtils).allowPortraitChange(self.context):
    29392938            emit_lock_message(self,
    29402939                _('This form is locked. You are in the wrong state.'))
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r16120 r16671  
    104104        """
    105105
     106    def allowPortraitChange(student):
     107        """Check if student is allowed to change the portrait file.
     108        """
     109
    106110    def setMatricNumber(student):
    107111        """Set matriculation number of student.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r16609 r16671  
    610610        return None, matric_number
    611611
     612    def allowPortraitChange(self, student):
     613        """Check if student is allowed to change the portrait file.
     614        """
     615        if student.state not in self.PORTRAIT_CHANGE_STATES:
     616            return False
     617        return True
     618
    612619    def getAccommodationDetails(self, student):
    613620        """Determine the accommodation data of a student.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py

    r16610 r16671  
    617617    @property
    618618    def target_url(self):
    619         PORTRAIT_CHANGE_STATES = getUtility(
    620             IStudentsUtils).PORTRAIT_CHANGE_STATES
    621         if self.context.state not in PORTRAIT_CHANGE_STATES:
     619        if not getUtility(IStudentsUtils).allowPortraitChange(self.context):
    622620            return ''
    623621        return self.view.url(self.view.context, self.target)
Note: See TracChangeset for help on using the changeset viewer.