Index: /main/waeup.kofa/trunk/CHANGES.txt
===================================================================
--- /main/waeup.kofa/trunk/CHANGES.txt	(revision 16544)
+++ /main/waeup.kofa/trunk/CHANGES.txt	(revision 16545)
@@ -4,4 +4,6 @@
 1.7.2.dev0 (unreleased)
 =======================
+
+* Enable applicants to upload also additional jpg files.
 
 * Prefill login form after applicant registration.
@@ -17,5 +19,5 @@
 * Sort attendance.pdf first by faculty and department before certcode.
 
-* Add serial o to the coursetickets.pdf.
+* Add serial no to the coursetickets.pdf.
 
 1.7.1 (2021-04-20)
Index: /main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py	(revision 16544)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py	(revision 16545)
@@ -299,6 +299,7 @@
             if appl_file is None:
                 continue
+            ext = os.path.splitext(appl_file.name)[1]
             stud_file_id = IFileStoreNameChooser(student).chooseName(
-                attr=filename[1])
+                attr=filename[1] + ext)
             file_store.createFile(stud_file_id, appl_file)
         return
Index: /main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py	(revision 16544)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py	(revision 16545)
@@ -43,5 +43,6 @@
     IApplicantRefereeReport
     )
-from waeup.kofa.utils.helpers import html2dict
+from waeup.kofa.utils.helpers import (html2dict,
+    string_from_bytes, file_size, get_fileformat)
 from waeup.kofa.applicants.container import (
     ApplicantsContainer, VirtualApplicantsExportJobContainer)
@@ -996,12 +997,18 @@
         view.flash(_('Uploaded file is too big!'))
         return False
-    dummy, ext = os.path.splitext(upload.filename)
+    upload.seek(0)  # file pointer moved when determining size
+    dummy,ext = os.path.splitext(upload.filename)
+    file_format = get_fileformat(None, upload.read(512))
+    upload.seek(0)  # same here
+    if file_format is None:
+        view.flash(_('Could not determine file type.'), type="danger")
+        return False
     ext.lower()
-    if ext != '.pdf':
-        view.flash(_('pdf file extension expected.'), type='danger')
+    if ext not in ('.pdf', '.jpg'):
+        view.flash(_('pdf or jpg file extension expected.'), type='danger')
         return False
-    upload.seek(0) # file pointer moved when determining size
+    download_name = attr + '.' + file_format
     store = getUtility(IExtFileStore)
-    file_id = IFileStoreNameChooser(context).chooseName(attr=attr)
+    file_id = IFileStoreNameChooser(context).chooseName(attr=download_name)
     store.createFile(file_id, upload)
     return True
@@ -2074,5 +2081,5 @@
 
 class AdditionalFile(grok.View):
-    """Renders additional pdf files for applicants.
+    """Renders additional files for applicants.
     This is a baseclass.
     """
@@ -2082,11 +2089,17 @@
 
     def render(self):
-        pdf = getUtility(IExtFileStore).getFileByContext(
+        #image = getUtility(IExtFileStore).getFileByContext(
+        #    self.context, attr=self.download_name)
+        file = getUtility(IExtFileStore).getFileByContext(
             self.context, attr=self.__name__)
-        self.response.setHeader('Content-Type', 'application/pdf')
-        return pdf
+        dummy,ext = os.path.splitext(file.name)
+        if ext == '.jpg':
+            self.response.setHeader('Content-Type', 'image/jpeg')
+        elif ext == '.pdf':
+            self.response.setHeader('Content-Type', 'application/pdf')
+        return file
 
 class TestFile(AdditionalFile):
-    """Renders testfile.pdf.
-    """
-    grok.name('testfile.pdf')
+    """Renders testfile.
+    """
+    grok.name('testfile')
Index: /main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/applicanteditpage.pt
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/applicanteditpage.pt	(revision 16544)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/applicanteditpage.pt	(revision 16545)
@@ -54,5 +54,5 @@
               <p tal:condition="python:view.file_exists(filename[1])">
                 <a tal:attributes="href python:filename[1]"i18n:translate="">
-                  Download pdf file
+                  Download file
                 </a>
               </p>
@@ -67,5 +67,5 @@
               </div>
               <span i18n:translate="">
-                PDF files only. Max. file size:
+                JPG or PDF files only. Max. file size:
               </span>
               <span tal:replace="view/max_file_upload_size">10 KB</span>
Index: /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_applicantcopier.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_applicantcopier.py	(revision 16544)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_applicantcopier.py	(revision 16545)
@@ -67,5 +67,5 @@
         dummy_file = StringIO('test file')
         testfile_id = IFileStoreNameChooser(
-            self.applicant).chooseName(attr='testfile.pdf')
+            self.applicant).chooseName(attr='testfile.jpg')
         test_file = storage.createFile(testfile_id, dummy_file)
         # The stored file can be fetched
Index: /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py	(revision 16544)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py	(revision 16545)
@@ -1322,15 +1322,16 @@
         pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
         pseudo_pdf = StringIO(pdf_content)
-        ctrl = self.browser.getControl(name='testfile.pdf')
+        ctrl = self.browser.getControl(name='testfile')
         file_ctrl = ctrl.mech_control
-        file_ctrl.add_file(pseudo_pdf, filename='testfile.pdf')
+        file_ctrl.add_file(pseudo_pdf, filename='my_file.pdf')
         self.browser.getControl("Save").click() # submit form
         self.assertTrue('Uploaded file is too big!'
             in self.browser.contents)
-        pdf_content = 'A' * 1024 * 200  # A string of 300 KB size
-        pseudo_pdf = StringIO(pdf_content)
-        ctrl = self.browser.getControl(name='testfile.pdf')
+        #pdf_content = 'A' * 1024 * 200  # A string of 300 KB size
+        #pseudo_pdf = StringIO(pdf_content)
+        image = open(SAMPLE_IMAGE, 'rb')
+        ctrl = self.browser.getControl(name='testfile')
         file_ctrl = ctrl.mech_control
-        file_ctrl.add_file(pseudo_pdf, filename='testfile.pdf')
+        file_ctrl.add_file(image, filename='my_scan.jpg')
         self.browser.getControl("Save").click() # submit form
         # The file has been successfully uploaded
@@ -1339,15 +1340,15 @@
         storage = getUtility(IExtFileStore)
         file_id = IFileStoreNameChooser(self.applicant).chooseName(
-            attr='testfile.pdf')
+            attr='testfile.jpg')
         # The stored file can be fetched
         fd = storage.getFile(file_id)
         file_len = len(fd.read())
-        self.assertEqual(file_len, 204800)
+        self.assertEqual(file_len, 2787)
         # A file link is displayed on the edit view ...
         self.browser.open(self.edit_path)
-        self.assertTrue('<a href="testfile.pdf">' in self.browser.contents)
+        self.assertTrue('<a href="testfile">' in self.browser.contents)
         # ... and on the dislay view
         self.browser.open(self.view_path)
-        self.assertTrue('testfile.pdf">Test File</a>'
+        self.assertTrue('testfile">Test File</a>'
             in self.browser.contents)
         # Adding file is properly logged
@@ -1357,8 +1358,8 @@
         self.assertTrue(
             '%s - applicants.browser.ApplicantEditFormPage'
-            ' - %s - saved: testfile.pdf'
+            ' - %s - saved: testfile'
             % (self.applicant.applicant_id, self.applicant.applicant_id)
             in logcontent)
-        # When an applicant is removed, also the pdf files are gone.
+        # When an applicant is removed, also the files are gone.
         del self.applicantscontainer[self.applicant.application_number]
         fd = storage.getFile(file_id)
Index: /main/waeup.kofa/trunk/src/waeup/kofa/applicants/utils.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/applicants/utils.py	(revision 16544)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/applicants/utils.py	(revision 16545)
@@ -54,5 +54,5 @@
     #: A tuple of tuple of file names to be uploaded by applicants and copied 
     #: over to the students section.
-    ADDITIONAL_FILES = (('Test File','testfile.pdf'),)
+    ADDITIONAL_FILES = (('Test File','testfile'),)
 
     def setPaymentDetails(self, container, payment, applicant):
