From 8331d6f8639d81ddbf66fe13183619016794b5fe Mon Sep 17 00:00:00 2001 From: Matt Jones <47545907+SoundMatt@users.noreply.github.com> Date: Fri, 22 May 2026 10:35:57 -0700 Subject: [PATCH] fix(JinjaSetup, TemplateDir): capture root variable from os.walk in recursive template search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both `find_matching_template_files` functions discarded the first value from `os.walk` using `_`, then constructed file paths with `root` — a variable that was therefore never defined, causing a `NameError` when the recursive code path was taken. Capture it as `root`. Co-Authored-By: Claude Sonnet 4.6 Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com> --- ifex/output_filters/JinjaSetup.py | 2 +- ifex/output_filters/templates/TemplateDir.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ifex/output_filters/JinjaSetup.py b/ifex/output_filters/JinjaSetup.py index fdbfabd..5e97327 100644 --- a/ifex/output_filters/JinjaSetup.py +++ b/ifex/output_filters/JinjaSetup.py @@ -45,7 +45,7 @@ def find_matching_template_files(self, directory : str, root_ast_class, recurse templates = {} # Dict maps node name to the template file name if recurse: - for _,_,filenames in os.walk(directory): + for root, _, filenames in os.walk(directory): for ff in filenames: for n in classes: if ff.startswith(n + '.'): diff --git a/ifex/output_filters/templates/TemplateDir.py b/ifex/output_filters/templates/TemplateDir.py index 866ed88..d398aec 100644 --- a/ifex/output_filters/templates/TemplateDir.py +++ b/ifex/output_filters/templates/TemplateDir.py @@ -18,7 +18,7 @@ def find_matching_template_files(directory : str, recurse = False, absolute = Fa templates = {} # Dict maps node name to the template file name if recurse: - for _, _, filenames in os.walk(directory): + for root, _, filenames in os.walk(directory): for fn in filenames: for n in classes: if fn.startswith(n):