Skip to content

Commit bed59fb

Browse files
committed
More verbose template rendering function name for more readable traceback
1 parent b073803 commit bed59fb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

adafruit_templateengine.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,13 @@ def _token_is_on_own_line(text_before_token: str) -> bool:
366366
return _LSTRIP_BLOCK_PATTERN.search(text_before_token) is not None
367367

368368

369-
def _create_template_function( # pylint: disable=,too-many-locals,too-many-branches,too-many-statements
369+
def _create_template_rendering_function( # pylint: disable=,too-many-locals,too-many-branches,too-many-statements
370370
template: str,
371371
language: str = Language.HTML,
372372
*,
373373
trim_blocks: bool = True,
374374
lstrip_blocks: bool = True,
375-
function_name: str = "_",
375+
function_name: str = "__template_rendering_function",
376376
context_name: str = "context",
377377
dry_run: bool = False,
378378
) -> "Generator[str] | str":
@@ -605,7 +605,9 @@ def __init__(self, template_string: str, *, language: str = Language.HTML) -> No
605605
:param str template_string: String containing the template to be rendered
606606
:param str language: Language for autoescaping. Defaults to HTML
607607
"""
608-
self._template_function = _create_template_function(template_string, language)
608+
self._template_function = _create_template_rendering_function(
609+
template_string, language
610+
)
609611

610612
def render_iter(
611613
self, context: dict = None, *, chunk_size: int = None

0 commit comments

Comments
 (0)