mirror of
https://github.com/django/django.git
synced 2024-12-22 00:55:44 +00:00
Refs #35326 -- Adjusted deprecation warning stacklevel in FileSystemStorage.OS_OPEN_FLAGS.
This commit is contained in:
parent
52ed2b645e
commit
47f18a7226
@ -48,6 +48,7 @@ class FileSystemStorage(Storage, StorageSettingsMixin):
|
||||
"Overriding OS_OPEN_FLAGS is deprecated. Use "
|
||||
"the allow_overwrite parameter instead.",
|
||||
RemovedInDjango60Warning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
|
@ -23,3 +23,7 @@ Bugfixes
|
||||
* Adjusted the deprecation warning ``stacklevel`` in :meth:`.Model.save` and
|
||||
:meth:`.Model.asave` to correctly point to the offending call site
|
||||
(:ticket:`35060`).
|
||||
|
||||
* 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`).
|
||||
|
@ -635,10 +635,11 @@ class OverwritingStorageOSOpenFlagsWarningTests(SimpleTestCase):
|
||||
def test_os_open_flags_deprecation_warning(self):
|
||||
msg = "Overriding OS_OPEN_FLAGS is deprecated. Use the allow_overwrite "
|
||||
msg += "parameter instead."
|
||||
with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
|
||||
with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
|
||||
self.storage = self.storage_class(
|
||||
location=self.temp_dir, base_url="/test_media_url/"
|
||||
)
|
||||
self.assertEqual(ctx.filename, __file__)
|
||||
|
||||
|
||||
# RemovedInDjango60Warning: Remove this test class.
|
||||
|
Loading…
Reference in New Issue
Block a user