summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlton Gibson <carlton.gibson@noumenal.es>2023-10-10 10:28:23 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-10-10 10:29:18 +0200
commit0cbc92bc3adb219265bd7f1bc00af1f526e1278a (patch)
tree0b306c45cb74aa73ab11a3057e4b879e4a8abe59
parent9c7627da3024923ed9f4364523db2524fef363fd (diff)
[4.2.x] Refs #26029 -- Improved get_storage_class() deprecation warning with stacklevel=2.
Addition of the `stacklevel` argument shows the source of the deprecated call, making updating the client code simpler. Backport of fa6e6f31137ee4025adfb27f88c07eebd488d446 from stable/5.0.x.
-rw-r--r--django/core/files/storage/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/core/files/storage/__init__.py b/django/core/files/storage/__init__.py
index 267f71ba37..d061d93061 100644
--- a/django/core/files/storage/__init__.py
+++ b/django/core/files/storage/__init__.py
@@ -29,7 +29,11 @@ GET_STORAGE_CLASS_DEPRECATED_MSG = (
def get_storage_class(import_path=None):
- warnings.warn(GET_STORAGE_CLASS_DEPRECATED_MSG, RemovedInDjango51Warning)
+ warnings.warn(
+ GET_STORAGE_CLASS_DEPRECATED_MSG,
+ RemovedInDjango51Warning,
+ stacklevel=2,
+ )
return import_string(import_path or settings.DEFAULT_FILE_STORAGE)