[1.9.x] Corrected stacklevel in Engine deprecation warnings.
Otherwise we just see django.template.loader and not the "original" callers.
This commit is contained in:
parent
ad0056567b
commit
ed95091561
|
@ -208,7 +208,7 @@ class Engine(object):
|
||||||
else:
|
else:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"The context_instance argument of render_to_string is "
|
"The context_instance argument of render_to_string is "
|
||||||
"deprecated.", RemovedInDjango110Warning, stacklevel=2)
|
"deprecated.", RemovedInDjango110Warning, stacklevel=3)
|
||||||
if dirs is _dirs_undefined:
|
if dirs is _dirs_undefined:
|
||||||
# Do not set dirs to None here to avoid triggering the deprecation
|
# Do not set dirs to None here to avoid triggering the deprecation
|
||||||
# warning in select_template or get_template.
|
# warning in select_template or get_template.
|
||||||
|
@ -216,13 +216,13 @@ class Engine(object):
|
||||||
else:
|
else:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"The dirs argument of render_to_string is deprecated.",
|
"The dirs argument of render_to_string is deprecated.",
|
||||||
RemovedInDjango110Warning, stacklevel=2)
|
RemovedInDjango110Warning, stacklevel=3)
|
||||||
if dictionary is _dictionary_undefined:
|
if dictionary is _dictionary_undefined:
|
||||||
dictionary = None
|
dictionary = None
|
||||||
else:
|
else:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"The dictionary argument of render_to_string was renamed to "
|
"The dictionary argument of render_to_string was renamed to "
|
||||||
"context.", RemovedInDjango110Warning, stacklevel=2)
|
"context.", RemovedInDjango110Warning, stacklevel=3)
|
||||||
context = dictionary
|
context = dictionary
|
||||||
|
|
||||||
if isinstance(template_name, (list, tuple)):
|
if isinstance(template_name, (list, tuple)):
|
||||||
|
@ -254,7 +254,7 @@ class Engine(object):
|
||||||
else:
|
else:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"The dirs argument of select_template is deprecated.",
|
"The dirs argument of select_template is deprecated.",
|
||||||
RemovedInDjango110Warning, stacklevel=2)
|
RemovedInDjango110Warning, stacklevel=3)
|
||||||
|
|
||||||
if not template_name_list:
|
if not template_name_list:
|
||||||
raise TemplateDoesNotExist("No template names provided")
|
raise TemplateDoesNotExist("No template names provided")
|
||||||
|
|
Loading…
Reference in New Issue