﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36559	partialdef tag embedded in verbatim tag is treated as the source property for that named partial	Jacob Walls		"Although `partial` and `partialdef` are correctly ignored when rendered if embedded within `{% verbatim %}`, the `PartialTemplate.source` property is fooled, potentially impacting error reporting:

{{{#!diff
diff --git a/tests/template_tests/syntax_tests/test_partials.py b/tests/template_tests/syntax_tests/test_partials.py
index a2cd3ae96a..6098531ed9 100644
--- a/tests/template_tests/syntax_tests/test_partials.py
+++ b/tests/template_tests/syntax_tests/test_partials.py
@@ -484,6 +484,11 @@ class PartialTagTests(SimpleTestCase):
         {
             ""partial_with_syntax_error"": (
                 ""<h1>Title</h1>\n""
+                ""{% verbatim %}\n""
+                ""{% partialdef syntax_error_partial %}\n""
+                ""VERBATIM\n""
+                ""{% endpartialdef %}\n""
+                ""{% endverbatim %}\n""
                 ""{% partialdef syntax_error_partial %}\n""
                 ""    {% if user %}\n""
                 ""        <p>User: {{ user.name }}</p>\n""
@@ -506,6 +511,7 @@ class PartialTagTests(SimpleTestCase):
             self.assertIn(""endpartialdef"", exc_debug[""during""])
             self.assertEqual(exc_debug[""name""], ""partial_with_syntax_error"")
             self.assertIn(""endif"", exc_debug[""message""].lower())
+            self.assertNotIn(""verbatim"", exc_debug[""source_lines""][0][1])
 
     @setup(
         {
}}}

{{{#!py
======================================================================
FAIL: test_partial_with_syntax_error_exception_info (template_tests.syntax_tests.test_partials.PartialTagTests.test_partial_with_syntax_error_exception_info)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""/Users/jwalls/django/django/test/utils.py"", line 458, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File ""/Users/jwalls/django/tests/template_tests/utils.py"", line 76, in inner
    func(self)
  File ""/Users/jwalls/django/tests/template_tests/syntax_tests/test_partials.py"", line 514, in test_partial_with_syntax_error_exception_info
    self.assertNotIn(""verbatim"", exc_debug[""source_lines""][0][1])
AssertionError: 'verbatim' unexpectedly found in '{% verbatim %}\n'
}}}
----
The use case presented here isn't very serious, so I'm loathe to really mark this as a release blocker, but as it's a new feature and that's our process, and I'm not sure if there are other more important uses of the source property, I'll start there."	Bug	new	Template system	dev	Release blocker				Unreviewed	0	0	0	0	0	0
