mirror of
https://github.com/django/django.git
synced 2024-12-22 09:05:43 +00:00
Refs #35405 -- Adjusted deprecation warning stacklevel in FieldCacheMixin.get_cache_name().
This commit is contained in:
parent
47f18a7226
commit
39abd56a7f
@ -28,6 +28,7 @@ class FieldCacheMixin:
|
||||
f"Override {self.__class__.__qualname__}.cache_name instead of "
|
||||
"get_cache_name().",
|
||||
RemovedInDjango60Warning,
|
||||
stacklevel=3,
|
||||
)
|
||||
return cache_name
|
||||
|
||||
|
@ -27,3 +27,7 @@ Bugfixes
|
||||
* Adjusted the deprecation warning ``stacklevel`` when using ``OS_OPEN_FLAGS``
|
||||
in :class:`~django.core.files.storage.FileSystemStorage` to correctly point
|
||||
to the offending call site (:ticket:`35326`).
|
||||
|
||||
* Adjusted the deprecation warning ``stacklevel`` in
|
||||
``FieldCacheMixin.get_cache_name()`` to correctly point to the offending call
|
||||
site (:ticket:`35405`).
|
||||
|
@ -34,9 +34,10 @@ class FieldCacheMixinTests(SimpleTestCase):
|
||||
# RemovedInDjango60Warning.
|
||||
def test_get_cache_name_deprecated(self):
|
||||
msg = "Override ExampleOld.cache_name instead of get_cache_name()."
|
||||
with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
|
||||
with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
|
||||
result = ExampleOld().cache_name
|
||||
self.assertEqual(result, "example")
|
||||
self.assertEqual(ctx.filename, __file__)
|
||||
|
||||
def test_cache_name(self):
|
||||
result = Example().cache_name
|
||||
|
Loading…
Reference in New Issue
Block a user