Пример #1
0
 def download_submission_set(self, submissions, filename, sub_folders):
     """ Create a tar archive with all the submissions """
     if len(submissions) == 0:
         raise web.notfound(renderer.notfound("There's no submission that matches your request"))
     try:
         web.header('Content-Type', 'application/x-gzip', unique=True)
         web.header('Content-Disposition', 'attachment; filename="' + filename + '"', unique=True)
         return get_submission_archive(submissions, sub_folders)
     except Exception as e:
         print e
         raise web.notfound()
Пример #2
0
def _get_submissions_data(course):
    """ Returns a file-like object to a tgz archive containing all the submissions made by the students for the course """
    submissions = list(get_database().submissions.find(
        {"courseid": course.get_id(), "username": {"$in": course.get_registered_users()}, "status": {"$in": ["done", "error"]}}))
    return get_submission_archive(submissions, ['username', 'taskid'])