File tree 3 files changed +7
-1
lines changed
django/core/files/storage
3 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ def __init__(
48
48
"Overriding OS_OPEN_FLAGS is deprecated. Use "
49
49
"the allow_overwrite parameter instead." ,
50
50
RemovedInDjango60Warning ,
51
+ stacklevel = 2 ,
51
52
)
52
53
53
54
@cached_property
Original file line number Diff line number Diff line change @@ -23,3 +23,7 @@ Bugfixes
23
23
* Adjusted the deprecation warning ``stacklevel`` in :meth:`.Model.save` and
24
24
:meth:`.Model.asave` to correctly point to the offending call site
25
25
(:ticket:`35060`).
26
+
27
+ * Adjusted the deprecation warning ``stacklevel`` when using ``OS_OPEN_FLAGS``
28
+ in :class:`~django.core.files.storage.FileSystemStorage` to correctly point
29
+ to the offending call site (:ticket:`35326`).
Original file line number Diff line number Diff line change @@ -635,10 +635,11 @@ def setUp(self):
635
635
def test_os_open_flags_deprecation_warning (self ):
636
636
msg = "Overriding OS_OPEN_FLAGS is deprecated. Use the allow_overwrite "
637
637
msg += "parameter instead."
638
- with self .assertWarnsMessage (RemovedInDjango60Warning , msg ):
638
+ with self .assertWarnsMessage (RemovedInDjango60Warning , msg ) as ctx :
639
639
self .storage = self .storage_class (
640
640
location = self .temp_dir , base_url = "/test_media_url/"
641
641
)
642
+ self .assertEqual (ctx .filename , __file__ )
642
643
643
644
644
645
# RemovedInDjango60Warning: Remove this test class.
You can’t perform that action at this time.
0 commit comments