From 920164060ec05395bbf247332ec2ded58d378c93 Mon Sep 17 00:00:00 2001 From: Feodor Fitsner Date: Wed, 26 Feb 2025 16:58:23 -0800 Subject: [PATCH] Update get_value --- {{cookiecutter.out_dir}}/_macros.jinja2 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.out_dir}}/_macros.jinja2 b/{{cookiecutter.out_dir}}/_macros.jinja2 index 97a9a5d..d6acd4b 100644 --- a/{{cookiecutter.out_dir}}/_macros.jinja2 +++ b/{{cookiecutter.out_dir}}/_macros.jinja2 @@ -7,13 +7,16 @@ {# Initialize the result with the input dictionary #} {% set result = dict %} + {# Use a flag to detect when to stop processing #} + {% set valid = true %} + {# Iterate through the keys and traverse the dictionary #} {% for key in keys %} - {% if result is mapping and key in result %} + {% if valid and result is mapping and key in result %} {% set result = result[key] %} {% else %} {% set result = none %} - {% break %} + {% set valid = false %} {% endif %} {% endfor %}