Skip to content

Commit ea9246e

Browse files
committed
Copy get_storage_class to our code base
1 parent c45c63c commit ea9246e

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ filterwarnings =
2222
ignore:DateTimeField .* received a naive datetime .* while time zone support is active:RuntimeWarning
2323
ignore:.*:DeprecationWarning
2424

25-
ignore:.*:django.utils.deprecation.RemovedInDjango50Warning
25+
ignore:.*:django.utils.deprecation.RemovedInDjango60Warning
2626
ignore:.*:elasticsearch.exceptions.ElasticsearchWarning
2727
ignore:.*:PendingDeprecationWarning

readthedocs/proxito/tests/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55
from django.conf import settings
66
from django.contrib.auth.models import User
7-
from django.core.files.storage import get_storage_class
7+
from readthedocs.storage import get_storage_class
88
from django.test import TestCase
99

1010
from readthedocs.builds.constants import LATEST

readthedocs/rtd_tests/tests/test_imported_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55
from django.conf import settings
6-
from django.core.files.storage import get_storage_class
6+
from readthedocs.storage import get_storage_class
77
from django.test import TestCase
88
from django.test.utils import override_settings
99
from django_dynamic_fixture import get

readthedocs/storage/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@
77
"""
88

99
from django.conf import settings
10-
from django.core.files.storage import get_storage_class
1110
from django.utils.functional import LazyObject
11+
from django.utils.module_loading import import_string
12+
13+
14+
# Borrowed from Django 4.2 since it was deprecrated and removed in 5.2
15+
# NOTE: we can use settings.STORAGES for our own storages as well if we want to use the standards.
16+
#
17+
# https://docs.djangoproject.com/en/5.0/ref/settings/#std-setting-STORAGES)
18+
# https://github.com/django/django/blob/4.2/django/core/files/storage/__init__.py#L31
19+
def get_storage_class(import_path=None):
20+
return import_string(import_path or settings.DEFAULT_FILE_STORAGE)
1221

1322

1423
class ConfiguredBuildMediaStorage(LazyObject):

0 commit comments

Comments
 (0)