summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradityacp2021-03-23 14:54:07 +0530
committeradityacp2021-03-23 14:54:07 +0530
commit8192bf7a17070f2202d9282a4873795127a17447 (patch)
tree7a7f0b29a23685734d45265773db916bedad380f
parent4ab8fc2eb90af1ec83eac98e0e9b71e47ac63b27 (diff)
downloadonline_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.py21
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')