mirror of
https://github.com/django/django.git
synced 2024-12-22 09:05:43 +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 "
|
||||
"DjangoTemplates instead.",
|
||||
RemovedInDjango60Warning,
|
||||
stacklevel=2,
|
||||
)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@ -96,6 +97,7 @@ class Jinja2DivFormRenderer(Jinja2):
|
||||
"The Jinja2DivFormRenderer transitional form renderer is deprecated. Use "
|
||||
"Jinja2 instead.",
|
||||
RemovedInDjango60Warning,
|
||||
stacklevel=2,
|
||||
)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
@ -64,16 +64,18 @@ class DeprecationTests(SimpleTestCase):
|
||||
"The DjangoDivFormRenderer transitional form renderer is deprecated. Use "
|
||||
"DjangoTemplates instead."
|
||||
)
|
||||
with self.assertRaisesMessage(RemovedInDjango60Warning, msg):
|
||||
with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
|
||||
DjangoDivFormRenderer()
|
||||
self.assertEqual(ctx.filename, __file__)
|
||||
|
||||
def test_jinja2_div_renderer_warning(self):
|
||||
msg = (
|
||||
"The Jinja2DivFormRenderer transitional form renderer is deprecated. Use "
|
||||
"Jinja2 instead."
|
||||
)
|
||||
with self.assertRaisesMessage(RemovedInDjango60Warning, msg):
|
||||
with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
|
||||
Jinja2DivFormRenderer()
|
||||
self.assertEqual(ctx.filename, __file__)
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango60Warning)
|
||||
def test_deprecation_renderers_can_be_instantiated(self):
|
||||
|
Loading…
Reference in New Issue
Block a user