mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Refs #32339 -- Adjusted deprecation warning stacklevel in transitional form renderers.
This commit is contained in:
parent
6bd5d4f705
commit
7e6e1c8383
@ -80,6 +80,7 @@ class DjangoDivFormRenderer(DjangoTemplates):
|
|||||||
"The DjangoDivFormRenderer transitional form renderer is deprecated. Use "
|
"The DjangoDivFormRenderer transitional form renderer is deprecated. Use "
|
||||||
"DjangoTemplates instead.",
|
"DjangoTemplates instead.",
|
||||||
RemovedInDjango60Warning,
|
RemovedInDjango60Warning,
|
||||||
|
stacklevel=2,
|
||||||
)
|
)
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
@ -96,6 +97,7 @@ class Jinja2DivFormRenderer(Jinja2):
|
|||||||
"The Jinja2DivFormRenderer transitional form renderer is deprecated. Use "
|
"The Jinja2DivFormRenderer transitional form renderer is deprecated. Use "
|
||||||
"Jinja2 instead.",
|
"Jinja2 instead.",
|
||||||
RemovedInDjango60Warning,
|
RemovedInDjango60Warning,
|
||||||
|
stacklevel=2,
|
||||||
)
|
)
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
@ -64,16 +64,18 @@ class DeprecationTests(SimpleTestCase):
|
|||||||
"The DjangoDivFormRenderer transitional form renderer is deprecated. Use "
|
"The DjangoDivFormRenderer transitional form renderer is deprecated. Use "
|
||||||
"DjangoTemplates instead."
|
"DjangoTemplates instead."
|
||||||
)
|
)
|
||||||
with self.assertRaisesMessage(RemovedInDjango60Warning, msg):
|
with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
|
||||||
DjangoDivFormRenderer()
|
DjangoDivFormRenderer()
|
||||||
|
self.assertEqual(ctx.filename, __file__)
|
||||||
|
|
||||||
def test_jinja2_div_renderer_warning(self):
|
def test_jinja2_div_renderer_warning(self):
|
||||||
msg = (
|
msg = (
|
||||||
"The Jinja2DivFormRenderer transitional form renderer is deprecated. Use "
|
"The Jinja2DivFormRenderer transitional form renderer is deprecated. Use "
|
||||||
"Jinja2 instead."
|
"Jinja2 instead."
|
||||||
)
|
)
|
||||||
with self.assertRaisesMessage(RemovedInDjango60Warning, msg):
|
with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
|
||||||
Jinja2DivFormRenderer()
|
Jinja2DivFormRenderer()
|
||||||
|
self.assertEqual(ctx.filename, __file__)
|
||||||
|
|
||||||
@ignore_warnings(category=RemovedInDjango60Warning)
|
@ignore_warnings(category=RemovedInDjango60Warning)
|
||||||
def test_deprecation_renderers_can_be_instantiated(self):
|
def test_deprecation_renderers_can_be_instantiated(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user