From 0ee1c2f05a49dc3494f4327d690a24d751c7e7f9 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Wed, 18 Dec 2019 11:27:13 -0500 Subject: [PATCH] Remove S3ReportStorage, because S3BotoStorage already handles a custom_domain argument --- lms/djangoapps/instructor/tests/test_api.py | 2 +- lms/djangoapps/instructor_task/models.py | 2 +- .../instructor_task/tests/test_models.py | 2 +- openedx/core/storage.py | 24 ------------------- 4 files changed, 3 insertions(+), 27 deletions(-) diff --git a/lms/djangoapps/instructor/tests/test_api.py b/lms/djangoapps/instructor/tests/test_api.py index 6001cc3806..3408f52b4a 100644 --- a/lms/djangoapps/instructor/tests/test_api.py +++ b/lms/djangoapps/instructor/tests/test_api.py @@ -3305,7 +3305,7 @@ class TestInstructorAPILevelsDataDump(SharedModuleStoreTestCase, LoginEnrollment ex_status = 503 ex_reason = 'Slow Down' url = reverse('list_report_downloads', kwargs={'course_id': text_type(self.course.id)}) - with patch('openedx.core.storage.S3ReportStorage.listdir', side_effect=BotoServerError(ex_status, ex_reason)): + with patch('storages.backends.s3boto.S3BotoStorage.listdir', side_effect=BotoServerError(ex_status, ex_reason)): response = self.client.post(url, {}) mock_error.assert_called_with( u'Fetching files failed for course: %s, status: %s, reason: %s', diff --git a/lms/djangoapps/instructor_task/models.py b/lms/djangoapps/instructor_task/models.py index 82ceea68a1..d4d0310614 100644 --- a/lms/djangoapps/instructor_task/models.py +++ b/lms/djangoapps/instructor_task/models.py @@ -212,7 +212,7 @@ class ReportStore(object): storage_type = config.get('STORAGE_TYPE', '').lower() if storage_type == 's3': return DjangoStorageReportStore( - storage_class='openedx.core.storage.S3ReportStorage', + storage_class='storages.backends.s3boto.S3BotoStorage', storage_kwargs={ 'bucket': config['BUCKET'], 'location': config['ROOT_PATH'], diff --git a/lms/djangoapps/instructor_task/tests/test_models.py b/lms/djangoapps/instructor_task/tests/test_models.py index 2d16d10454..5eab482b9f 100644 --- a/lms/djangoapps/instructor_task/tests/test_models.py +++ b/lms/djangoapps/instructor_task/tests/test_models.py @@ -125,7 +125,7 @@ class DjangoStorageReportStoreS3TestCase(MockS3Mixin, ReportStoreTestMixin, Test storage. """ test_settings = copy.deepcopy(settings.GRADES_DOWNLOAD) - test_settings['STORAGE_CLASS'] = 'openedx.core.storage.S3ReportStorage' + test_settings['STORAGE_CLASS'] = 'storages.backends.s3boto.S3BotoStorage' test_settings['STORAGE_KWARGS'] = { 'bucket': settings.GRADES_DOWNLOAD['BUCKET'], 'location': settings.GRADES_DOWNLOAD['ROOT_PATH'], diff --git a/openedx/core/storage.py b/openedx/core/storage.py index 3c60bb0949..262ff47580 100644 --- a/openedx/core/storage.py +++ b/openedx/core/storage.py @@ -9,7 +9,6 @@ from django.utils.deconstruct import deconstructible from django.utils.lru_cache import lru_cache from pipeline.storage import NonPackagingMixin, PipelineCachedStorage from require.storage import OptimizedFilesMixin -from storages.backends.s3boto import S3BotoStorage from openedx.core.djangoapps.theming.storage import ThemeCachedFilesMixin, ThemePipelineMixin, ThemeStorage @@ -68,29 +67,6 @@ class DevelopmentStorage( pass -class S3ReportStorage(S3BotoStorage): # pylint: disable=abstract-method - """ - Storage for reports. - """ - def __init__(self, acl=None, bucket=None, custom_domain=None, **settings): - """ - init method for S3ReportStorage, Note that we have added an extra key-word - argument named "custom_domain" and this argument should not be passed to the superclass's init. - - Args: - acl: content policy for the uploads i.e. private, public etc. - bucket: Name of S3 bucket to use for storing and/or retrieving content - custom_domain: custom domain to use for generating file urls - **settings: additional settings to be passed in to S3BotoStorage, - - Returns: - - """ - if custom_domain: - self.custom_domain = custom_domain - super(S3ReportStorage, self).__init__(acl=acl, bucket=bucket, **settings) - - @deconstructible class OverwriteStorage(FileSystemStorage): """