Skip to content

Commit b36719a

Browse files
committed
feat: remove unnecessary validations and add ORA storage to use in submissions files
1 parent affcaae commit b36719a

1 file changed

Lines changed: 1 addition & 20 deletions

File tree

submissions/models.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,17 @@
1111

1212
import logging
1313
import os
14-
import sys
1514
from datetime import timedelta
1615
from uuid import uuid4
1716

1817
from django.conf import settings
1918
from django.contrib import auth
20-
from django.core.files.storage import FileSystemStorage
2119
from django.db import DatabaseError, models, transaction
2220
from django.db.models.signals import post_save, pre_save
2321
from django.dispatch import Signal, receiver
2422
from django.utils.timezone import now
2523
from jsonfield import JSONField
2624
from model_utils.models import TimeStampedModel
27-
from storages.backends.s3boto3 import S3Boto3Storage
2825

2926
from submissions.errors import DuplicateTeamSubmissionsError, TeamSubmissionInternalError, TeamSubmissionNotFoundError
3027

@@ -711,22 +708,6 @@ def submission_file_path(instance, _):
711708
)
712709

713710

714-
# pylint: disable=abstract-method
715-
class SubmissionFileStorage(S3Boto3Storage):
716-
"""
717-
Custom storage class for submission files that uses S3 in production with ORA bucket
718-
and FileSystemStorage during tests.
719-
720-
This class automatically detects test environments and changes behavior accordingly.
721-
"""
722-
def __new__(cls, *args, **kwargs):
723-
if 'pytest' in sys.modules or any('test' in arg for arg in sys.argv):
724-
return FileSystemStorage(*args, **kwargs)
725-
return super().__new__(cls) # pragma: no cover
726-
727-
bucket_name = getattr(settings, "FILE_UPLOAD_STORAGE_BUCKET_NAME", "openedx")
728-
729-
730711
class SubmissionFile(models.Model):
731712
"""
732713
Model to handle files associated with submissions
@@ -741,7 +722,7 @@ class SubmissionFile(models.Model):
741722
file = models.FileField(
742723
upload_to=submission_file_path,
743724
max_length=512,
744-
storage=SubmissionFileStorage()
725+
# storage=SubmissionFileStorage()
745726
)
746727
original_filename = models.CharField(max_length=255) # This is necessary to send file name to xqueue-watcher
747728
created_at = models.DateTimeField(default=now)

0 commit comments

Comments
 (0)