Skip to content

Commit bb33ff0

Browse files
committed
fix: Better fallback for includes when scanning for placeholders
1 parent 5d8f211 commit bb33ff0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cms/utils/placeholder.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
Context,
1414
NodeList,
1515
Template,
16+
TemplateDoesNotExist,
1617
TemplateSyntaxError,
1718
Variable,
1819
engines,
@@ -219,7 +220,11 @@ def _scan_placeholders(
219220
if isinstance(node.template.var, Variable):
220221
continue
221222
else:
222-
template = get_template(node.template.var)
223+
try:
224+
template = get_template(node.template.var)
225+
except (TemplateDoesNotExist, TemplateSyntaxError):
226+
# Include might be inside if else, so no need to error out here
227+
continue
223228
else:
224229
template = node.template
225230
nodes += _scan_placeholders(

0 commit comments

Comments
 (0)