$def with (inputId,max_size,allowed_exts, json) $# $# This file is part of INGInious. See the LICENSE and the COPYRIGHTS files for $# more information about the licensing of this file. $# $def sizeof_fmt(num): $ num=float(num) $for x in ['bytes','KB','MB','GB']: $if -1024 < num < 1024: $return "%3.1f%s" % (num, x) $ num /= 1024.0 $return "%3.1f%s" % (num, 'TB') $ allowed_exts= allowed_exts or default_allowed_file_extensions $ max_size= max_size or default_max_file_size
Max file size: $sizeof_fmt(max_size)
Allowed extensions: $', '.join(allowed_exts)