Exemple #1
0
def download_input_file_view(request, test_id):
    test = get_object_or_404(Test, id=test_id)

    if not can_admin_instance_of_problem(request, test.problem):
        raise PermissionDenied
    return stream_file(test.input_file,
                       strip_num_or_hash(test.input_file.name))
Exemple #2
0
def download_input_file_view(request, test_id):
    test = get_object_or_404(Test, id=test_id)

    if not can_admin_instance_of_problem(request, test.problem):
        raise PermissionDenied
    return stream_file(test.input_file,
                       strip_num_or_hash(test.input_file.name))
Exemple #3
0
def download_checker_exe_view(request, checker_id):
    checker = get_object_or_404(OutputChecker, id=checker_id)
    if not can_admin_instance_of_problem(request, checker.problem):
        raise PermissionDenied
    if not checker.exe_file:
        raise Http404
    return stream_file(checker.exe_file,
                       strip_num_or_hash(checker.exe_file.name))
Exemple #4
0
def download_checker_exe_view(request, checker_id):
    checker = get_object_or_404(OutputChecker, id=checker_id)
    if not can_admin_instance_of_problem(request, checker.problem):
        raise PermissionDenied
    if not checker.exe_file:
        raise Http404
    return stream_file(checker.exe_file,
                       strip_num_or_hash(checker.exe_file.name))
Exemple #5
0
def show_problem_attachment_view(request, attachment_id):
    attachment = get_object_or_404(ProblemAttachment, id=attachment_id)
    if not can_admin_instance_of_problem(request, attachment.problem):
        raise PermissionDenied
    return stream_file(attachment.content, attachment.download_name)
Exemple #6
0
def show_statement_view(request, statement_id):
    statement = get_object_or_404(ProblemStatement, id=statement_id)
    if not can_admin_instance_of_problem(request, statement.problem):
        raise PermissionDenied
    return stream_file(statement.content, statement.download_name)
Exemple #7
0
def show_problem_attachment_view(request, attachment_id):
    attachment = get_object_or_404(ProblemAttachment, id=attachment_id)
    if not can_admin_instance_of_problem(request, attachment.problem):
        raise PermissionDenied
    return stream_file(attachment.content, attachment.download_name)
Exemple #8
0
def show_statement_view(request, statement_id):
    statement = get_object_or_404(ProblemStatement, id=statement_id)
    if not can_admin_instance_of_problem(request, statement.problem):
        raise PermissionDenied
    return stream_file(statement.content, statement.download_name)