From 9903bb00888f20dfd2d39754e5ee22eeb5f36298 Mon Sep 17 00:00:00 2001 From: Tris Forster Date: Mon, 26 Aug 2024 11:55:38 +1000 Subject: [PATCH] Updated cache to not use get_storage_class --- byostorage/__init__.py | 2 +- byostorage/cached.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/byostorage/__init__.py b/byostorage/__init__.py index 5326831..dcdadfd 100644 --- a/byostorage/__init__.py +++ b/byostorage/__init__.py @@ -1,2 +1,2 @@ -__version__ = '0.2.3' +__version__ = '0.2.4' default_app_config = 'byostorage.apps.BYOStorageConfig' diff --git a/byostorage/cached.py b/byostorage/cached.py index e15f3c5..2fbf442 100644 --- a/byostorage/cached.py +++ b/byostorage/cached.py @@ -1,5 +1,6 @@ -from django.core.files.storage import Storage, get_storage_class +from django.core.files.storage import Storage, DefaultStorage from django.utils.deconstruct import deconstructible +from django.utils.module_loading import import_string from django.conf import settings from hashlib import sha1 import os.path @@ -15,14 +16,14 @@ class CachedStorage(Storage): def __init__(self, remote=None, cachedir=None, expires=600): if not remote: - remote = getattr(settings, 'CACHED_STORAGE_REMOTE', None) + remote = getattr(settings, 'CACHED_STORAGE_REMOTE', DefaultStorage) if not cachedir: cachedir = getattr(settings, 'CACHED_STORAGE_DIR', 'cache') if isinstance(remote, Storage): self.remote = remote else: - self.remote = get_storage_class(remote)() + self.remote = import_string(remote)() self.cachedir = cachedir self.expires = expires