mirror of
https://github.com/django/django.git
synced 2025-09-10 11:09:12 +00:00
This commit is contained in:
parent
686a8a62ae
commit
34bd3ed944
@ -52,10 +52,12 @@ times with multiple contexts)
|
|||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import warnings
|
import warnings
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
|
import django
|
||||||
from django.template.context import BaseContext
|
from django.template.context import BaseContext
|
||||||
from django.utils.formats import localize
|
from django.utils.formats import localize
|
||||||
from django.utils.html import conditional_escape
|
from django.utils.html import conditional_escape
|
||||||
@ -327,7 +329,7 @@ class PartialTemplate:
|
|||||||
"PartialTemplate.source is only available when template "
|
"PartialTemplate.source is only available when template "
|
||||||
"debugging is enabled.",
|
"debugging is enabled.",
|
||||||
RuntimeWarning,
|
RuntimeWarning,
|
||||||
stacklevel=2,
|
skip_file_prefixes=(os.path.dirname(django.__file__),),
|
||||||
)
|
)
|
||||||
return self.find_partial_source(template.source)
|
return self.find_partial_source(template.source)
|
||||||
|
|
||||||
|
@ -144,8 +144,9 @@ class PartialTagsTests(TestCase):
|
|||||||
RuntimeWarning,
|
RuntimeWarning,
|
||||||
"PartialTemplate.source is only available when template "
|
"PartialTemplate.source is only available when template "
|
||||||
"debugging is enabled.",
|
"debugging is enabled.",
|
||||||
):
|
) as ctx:
|
||||||
self.assertEqual(partial.template.source, "")
|
self.assertEqual(partial.template.source, "")
|
||||||
|
self.assertEqual(ctx.filename, __file__)
|
||||||
|
|
||||||
|
|
||||||
class RobustPartialHandlingTests(TestCase):
|
class RobustPartialHandlingTests(TestCase):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user