Skip to content

Commit 6c39240

Browse files
committed
Rename submission storage to bulk storage
1 parent f0c511a commit 6c39240

File tree

6 files changed

+20
-19
lines changed

6 files changed

+20
-19
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ git-roots
3030
/.idea
3131
/.env
3232

33-
submissions
33+
bulk-storage
3434

3535
/.coverage
3636
/coverage.xml
File renamed without changes.

course/management/commands/uploadstofiles.py renamed to course/management/commands/bulktofiles.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def convert_flow_page_visit(stderr, fpv):
6262

6363
class Command(BaseCommand):
6464
help = (
65-
"Migrates file upload submissions out of the database and into "
66-
"the storage given by RELATE_SUBMISSION_STORAGE. This command may "
65+
"Migrates bulk data (e.g. file upload submissions) out of the database "
66+
"and into the storage given by RELATE_BULK_STORAGE. This command may "
6767
"safely be interrupted and will pick up where it left off.")
6868

6969
def handle(self, *args, **options):

course/page/upload.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ def get_submission_filename_pattern(self, page_context, mime_type):
219219
flow_id = page_context.flow_session.flow_id
220220

221221
return (f"{page_context.course.identifier}/"
222-
"upload/"
222+
"submission/"
223+
"file-upload/"
223224
f"{flow_id}/"
224225
f"{self.page_desc.id}/"
225226
f"{username}"
@@ -230,10 +231,10 @@ def file_to_answer_data(self, page_context, uploaded_file, mime_type):
230231
mime_type, = self.page_desc.mime_types
231232

232233
from django.conf import settings
233-
submission_storage = settings.RELATE_SUBMISSION_STORAGE
234+
bulk_storage = settings.RELATE_BULK_STORAGE
234235

235236
uploaded_file.seek(0)
236-
saved_name = submission_storage.save(
237+
saved_name = bulk_storage.save(
237238
self.get_submission_filename_pattern(page_context, mime_type),
238239
uploaded_file)
239240

@@ -248,8 +249,8 @@ def get_content_from_answer_data(answer_data):
248249

249250
if "storage_filename" in answer_data:
250251
from django.conf import settings
251-
submission_storage = settings.RELATE_SUBMISSION_STORAGE
252-
with submission_storage.open(answer_data["storage_filename"]) as inf:
252+
bulk_storage = settings.RELATE_BULK_STORAGE
253+
with bulk_storage.open(answer_data["storage_filename"]) as inf:
253254
return inf.read(), mime_type
254255

255256
elif "base64_data" in answer_data:

local_settings_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@
9595

9696
# }}}
9797

98-
# {{{ submission storage
98+
# {{{ bulk storage
9999

100100
from django.core.files.storage import FileSystemStorage
101101
# This must be a subclass of django.core.storage.Storage.
102102
# This should *not* be MEDIA_ROOT, and the corresponding directory/storage location
103103
# should *not* be accessible under a URL.
104-
RELATE_SUBMISSION_STORAGE = FileSystemStorage(path.join(_BASEDIR, "submissions"))
104+
RELATE_BULK_STORAGE = FileSystemStorage(path.join(_BASEDIR, "bulk-storage"))
105105

106106
# }}}
107107

relate/checks.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
RELATE_SESSION_RESTART_COOLDOWN_SECONDS = "RELATE_SESSION_RESTART_COOLDOWN_SECONDS"
4949
RELATE_TICKET_MINUTES_VALID_AFTER_USE = "RELATE_TICKET_MINUTES_VALID_AFTER_USE"
5050
GIT_ROOT = "GIT_ROOT"
51-
RELATE_SUBMISSION_STORAGE = "RELATE_SUBMISSION_STORAGE"
51+
RELATE_BULK_STORAGE = "RELATE_BULK_STORAGE"
5252
RELATE_STARTUP_CHECKS = "RELATE_STARTUP_CHECKS"
5353
RELATE_STARTUP_CHECKS_EXTRA = "RELATE_STARTUP_CHECKS_EXTRA"
5454

@@ -348,21 +348,21 @@ def check_relate_settings(app_configs, **kwargs):
348348

349349
# }}}
350350

351-
# {{{ check RELATE_SUBMISSION_STORAGE
351+
# {{{ check RELATE_BULK_STORAGE
352352

353-
submission_storage = getattr(settings, RELATE_SUBMISSION_STORAGE, None)
353+
bulk_storage = getattr(settings, RELATE_BULK_STORAGE, None)
354354
from django.core.files.storage import Storage
355-
if submission_storage is None:
355+
if bulk_storage is None:
356356
errors.append(RelateCriticalCheckMessage(
357357
msg=REQUIRED_CONF_ERROR_PATTERN % {
358-
"location": RELATE_SUBMISSION_STORAGE},
359-
id="submission_storage.E001"
358+
"location": RELATE_BULK_STORAGE},
359+
id="bulk_storage.E001"
360360
))
361-
elif not isinstance(submission_storage, Storage):
361+
elif not isinstance(bulk_storage, Storage):
362362
errors.append(RelateCriticalCheckMessage(
363363
msg=INSTANCE_ERROR_PATTERN % {
364-
"location": RELATE_SUBMISSION_STORAGE, "types": "Storage"},
365-
id="submission_storage.E002"
364+
"location": RELATE_BULK_STORAGE, "types": "Storage"},
365+
id="bulk_storage.E002"
366366
))
367367

368368
# }}}

0 commit comments

Comments
 (0)