Changeset 9930 for main


Ignore:
Timestamp:
2 Feb 2013, 16:53:16 (12 years ago)
Author:
Henrik Bettermann
Message:

Temporary solution to prevent users from uploading non-ascii files.

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

Legend:

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

    r9857 r9930  
    10381038                return
    10391039            target = os.path.join(self.context.storage, normalized_filename)
    1040             open(target, 'wb').write(uploadfile.read())
     1040            filecontent = uploadfile.read()
     1041
     1042            # XXX: temporary solution to prevent users from
     1043            # uploading non-ascii files.
     1044            for element in filecontent:
     1045                try:
     1046                    if ord(element) > 128:
     1047                      self.flash(_(
     1048                          "Only ASCII files are allowed. "
     1049                          "Your file contains non-ascii characters."))
     1050                      return
     1051                except TypeError:
     1052                    self.flash(_(
     1053                        "Only ASCII files are allowed. "
     1054                        "Your file contains non-ASCII characters."))
     1055                    return
     1056
     1057            open(target, 'wb').write(filecontent)
    10411058            os.chmod(target, 0664)
    10421059            logger = self.context.logger
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/datacenteruploadpage.pt

    r9609 r9930  
    1 <p class="alert-message warning" i18n:translate="">
    2     <strong>NOTICE:</strong>
     1<p i18n:translate="">
    32    Before uploading a file check that your file header corresponds
    43    with header format of the selected processor. All available headers
Note: See TracChangeset for help on using the changeset viewer.