From 227ce5fccb5864657f080c25528263b655c2b6b7 Mon Sep 17 00:00:00 2001 From: Tris Forster Date: Wed, 21 Dec 2022 08:22:14 +1100 Subject: [PATCH] Fixed passing Storage instance --- byostorage/cached.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/byostorage/cached.py b/byostorage/cached.py index 5584bc7..e15f3c5 100644 --- a/byostorage/cached.py +++ b/byostorage/cached.py @@ -18,8 +18,11 @@ class CachedStorage(Storage): remote = getattr(settings, 'CACHED_STORAGE_REMOTE', None) if not cachedir: cachedir = getattr(settings, 'CACHED_STORAGE_DIR', 'cache') - - self.remote = get_storage_class(remote)() + + if isinstance(remote, Storage): + self.remote = remote + else: + self.remote = get_storage_class(remote)() self.cachedir = cachedir self.expires = expires