def _check_files_limits(files):
 for fileinput_id in files.keys():
  inputfiles = files.getlist(fileinput_id)
  if (len(inputfiles) > settings.MAX_FILEUPLOADS_PER_INPUT):
   msg = ('Submission aborted! Maximum %d files may be submitted at once' % settings.MAX_FILEUPLOADS_PER_INPUT)
   return msg
  for inputfile in inputfiles:
   if (inputfile.size > settings.STUDENT_FILEUPLOAD_MAX_SIZE):
    msg = ('Submission aborted! Your file "%s" is too large (max size: %d MB)' % (inputfile.name, (settings.STUDENT_FILEUPLOAD_MAX_SIZE / (1000 ** 2))))
    return msg
 return None

def _check_files_limits ( files ) : for fileinput_id in files . keys ( ) : inputfiles = files . getlist ( fileinput_id ) if ( len ( inputfiles ) > settings . MAX_FILEUPLOADS_PER_INPUT ) : msg = ( 'Submission aborted! Maximum %d files may be submitted at once' % settings . MAX_FILEUPLOADS_PER_INPUT ) return msg for inputfile in inputfiles : if ( inputfile . size > settings . STUDENT_FILEUPLOAD_MAX_SIZE ) : msg = ( 'Submission aborted! Your file "%s" is too large (max size: %d MB)' % ( inputfile . name , ( settings . STUDENT_FILEUPLOAD_MAX_SIZE / ( 1000 ** 2 ) ) ) ) return msg return None
check if the files in a request are under the limits defined by settings .