diff options
author | adityacp | 2021-03-23 14:54:07 +0530 |
---|---|---|
committer | adityacp | 2021-03-23 14:54:07 +0530 |
commit | 8192bf7a17070f2202d9282a4873795127a17447 (patch) | |
tree | 7a7f0b29a23685734d45265773db916bedad380f | |
parent | 4ab8fc2eb90af1ec83eac98e0e9b71e47ac63b27 (diff) | |
download | online_test-8192bf7a17070f2202d9282a4873795127a17447.tar.gz online_test-8192bf7a17070f2202d9282a4873795127a17447.tar.bz2 online_test-8192bf7a17070f2202d9282a4873795127a17447.zip |
Change zip file write for assignment downloads
-rw-r--r-- | yaksh/views.py | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index f0fe2e8..12bc072 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -2392,21 +2392,12 @@ def download_assignment_file(request, quiz_id, course_id, for f_name in assignment_files: folder = f_name.answer_paper.user.get_full_name().replace(" ", "_") sub_folder = f_name.assignmentQuestion.summary.replace(" ", "_") - if settings.USE_AWS: - folder_name = os.sep.join((folder, sub_folder)) - download_url = f_name.assignmentFile.url - zip_file.writestr( - os.path.join(folder_name, os.path.basename(download_url)), - f_name.assignmentFile.read() - ) - else: - folder_name = os.sep.join((folder, sub_folder, os.path.basename( - f_name.assignmentFile.name)) - ) - zip_file.write( - f_name.assignmentFile.path, folder_name - ) - + folder_name = os.sep.join((folder, sub_folder)) + download_url = f_name.assignmentFile.url + zip_file.writestr( + os.path.join(folder_name, os.path.basename(download_url)), + f_name.assignmentFile.read() + ) zip_file.close() zipfile_name.seek(0) response = HttpResponse(content_type='application/zip') |