From 9930fef28b152d431544998847a2b4a1d23e9d9a Mon Sep 17 00:00:00 2001 From: Rob Duffy Date: Mon, 2 Dec 2024 20:25:57 +0100 Subject: [PATCH] Cast the generator returned by find_referenced_templates() to an iterable to avoid exhausting it on the check for None Co-authored-by: Jeremy Stretch --- netbox/utilities/jinja2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/utilities/jinja2.py b/netbox/utilities/jinja2.py index 8286ae171..dd2f083ad 100644 --- a/netbox/utilities/jinja2.py +++ b/netbox/utilities/jinja2.py @@ -28,7 +28,7 @@ class DataFileLoader(BaseLoader): raise TemplateNotFound(template) # Find and pre-fetch referenced templates - if referenced_templates := find_referenced_templates(environment.parse(template_source)): + if referenced_templates := tuple(find_referenced_templates(environment.parse(template_source))): if None in referenced_templates: self.cache_templates({ df.path: df.data_as_string for df in