Ignore:
Timestamp:
21 Nov 2019, 06:43:08 (5 years ago)
Author:
Henrik Bettermann
Message:

Make max passport picture size customizable.

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

Legend:

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

    r15819 r15833  
    3838    IApplicant, IApplicantEdit, IApplicantsRoot,
    3939    IApplicantsContainer, IApplicantsContainerAdd,
    40     MAX_UPLOAD_SIZE, IApplicantOnlinePayment, IApplicantsUtils,
     40    IApplicantOnlinePayment, IApplicantsUtils,
    4141    IApplicantRegisterUpdate, ISpecialApplicant,
    4242    IApplicantRefereeReport
     
    919919    points to end of file when leaving this function.
    920920    """
     921    max_upload_size = getUtility(IKofaUtils).MAX_PASSPORT_SIZE
    921922    size = file_size(upload)
    922     if size > MAX_UPLOAD_SIZE:
     923    if size > max_upload_size:
    923924        view.flash(_('Uploaded image is too big!'), type='danger')
    924925        return False
     
    989990    def update(self):
    990991        super(ApplicantManageFormPage, self).update()
     992        max_upload_size = getUtility(IKofaUtils).MAX_PASSPORT_SIZE
    991993        self.wf_info = IWorkflowInfo(self.context)
    992         self.max_upload_size = string_from_bytes(MAX_UPLOAD_SIZE)
     994        self.max_upload_size = string_from_bytes(max_upload_size)
    993995        self.upload_success = None
    994996        upload = self.request.form.get('form.passport', None)
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py

    r15790 r15833  
    4040    AppCatSource, CertificateSource, SpecialApplicationSource)
    4141
    42 #: Maximum upload size for applicant passport photographs (in bytes)
    43 MAX_UPLOAD_SIZE = 1024 * 50
    44 
    4542_marker = object() # a marker different from None
    4643
  • main/waeup.kofa/trunk/src/waeup/kofa/students/fileviewlets.py

    r15652 r15833  
    2222from waeup.kofa.interfaces import MessageFactory as _
    2323from waeup.kofa.interfaces import (
    24     IExtFileStore, IFileStoreNameChooser, IKofaObject)
     24    IExtFileStore, IFileStoreNameChooser, IKofaObject, IKofaUtils)
    2525from waeup.kofa.utils.helpers import string_from_bytes, file_size
    2626from waeup.kofa.browser import DEFAULT_IMAGE_PATH
     
    107107    grok.template('imageupload')
    108108    label = _(u'Passport Picture (jpg only)')
    109     mus = 1024 * 50
    110109    download_name = u'passport.jpg'
    111110    tab_redirect = '#tab2'
     111
     112    @property
     113    def mus(self):
     114        kofa_utils = getUtility(IKofaUtils)
     115        return kofa_utils.MAX_PASSPORT_SIZE
    112116
    113117
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r15685 r15833  
    239239    MAX_FILES = 100
    240240
     241    #: Maximum size in Bytes of passport images in the applicants and
     242    #: students section
     243    MAX_PASSPORT_SIZE = 50 * 1024
     244
    241245    #: Temporary passwords and parents password validity period
    242246    TEMP_PASSWORD_MINUTES = 10
Note: See TracChangeset for help on using the changeset viewer.