[BACKEND] Allow more nesting for source + override variables (#150)

This commit is contained in:
Jesse Bannon 2022-08-04 14:42:20 -07:00 committed by GitHub
parent b3883de7c4
commit b28ef2365b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -77,7 +77,7 @@ class StringFormatterValidator(Validator):
"Format variable '{variable_name}' does not exist. Available variables: {available_fields}"
)
__max_format_recursion = 3
_max_format_recursion = 8
def __validate_and_get_format_variables(self) -> List[str]:
"""
@ -168,7 +168,7 @@ class StringFormatterValidator(Validator):
# Keep formatting the format string until no format_variables are present
formatter = self
recursion_depth = 0
max_depth = StringFormatterValidator.__max_format_recursion
max_depth = self._max_format_recursion
while formatter.format_variables and recursion_depth < max_depth:
formatter = self.__apply_formatter(formatter=formatter, variable_dict=variable_dict)

View file

@ -160,6 +160,7 @@ class TestStringFormatterValidator(object):
)
format_string = string_formatter_class(name="test", value="{level_a}")
format_string._max_format_recursion = 3
with pytest.raises(StringFormattingException, match=expected_error_msg):
_ = format_string.apply_formatter(variable_dict=variable_dict)