Changeset 11608


Ignore:
Timestamp:
30 Apr 2014, 11:49:18 (11 years ago)
Author:
Henrik Bettermann
Message:

Fingerprint file upload enabled.

Location:
main/waeup.kofa/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r11604 r11608  
    441.2dev (unreleased)
    55===================
     6
     7* Fingerprint file upload enabled.
    68
    79* is_fresh property method added to Student class.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py

    r11558 r11608  
    5656grok.templatedir('browser_templates')
    5757
    58 ALLOWED_FILE_EXTENSIONS = ('jpg', 'png', 'pdf', 'tif')
     58ALLOWED_FILE_EXTENSIONS = ('jpg', 'png', 'pdf', 'tif', 'fp')
    5959
    6060class StudentManageSidebar(grok.ViewletManager):
     
    828828        return False
    829829    upload.seek(0) # file pointer moved when determining size
    830     file_format = get_fileformat(None, upload.read(512))
    831     upload.seek(0) # same here
     830    dummy,ext = os.path.splitext(upload.filename)
     831    # fp files are expected to be fingerprint scans, file
     832    # format is not yet checked
     833    if ext == '.fp':
     834        file_format = 'fp'
     835    else:
     836        file_format = get_fileformat(None, upload.read(512))
     837        upload.seek(0) # same here
    832838    if file_format is None:
    833839        view.flash(_('Could not determine file type.'), type="danger")
     
    10101016        if ext == '.jpg':
    10111017            self.response.setHeader('Content-Type', 'image/jpeg')
     1018        elif ext == '.fp':
     1019            self.response.setHeader('Content-Type', 'application/binary')
    10121020        elif ext == '.png':
    10131021            self.response.setHeader('Content-Type', 'image/png')
Note: See TracChangeset for help on using the changeset viewer.