[FIX] script search class model: hide error for default lambda funct

This commit is contained in:
Mathieu Benoit 2024-05-04 13:15:00 -04:00
parent e65984e13a
commit 97d4717d74

View file

@ -156,11 +156,18 @@ def fill_search_field(ast_obj, var_name="", py_filename=""):
# Support -> fields.Date.context_today
parent_node = ast_obj
lst_call_lambda = []
while hasattr(parent_node, "value"):
lst_call_lambda.insert(0, parent_node.attr)
parent_node = parent_node.value
lst_call_lambda.insert(0, parent_node.id)
result = ".".join(lst_call_lambda)
if hasattr(parent_node, "id"):
while hasattr(parent_node, "value"):
lst_call_lambda.insert(0, parent_node.attr)
parent_node = parent_node.value
lst_call_lambda.insert(0, parent_node.id)
result = ".".join(lst_call_lambda)
else:
# default=uuid.uuid4().hex
_logger.warning(
f"Cannot support keyword of variable {var_name} type"
f" {ast_obj_type} in filename {py_filename}, because parent_node is type ast.Call."
)
elif ast_obj_type is ast.List:
result = [fill_search_field(a, var_name) for a in ast_obj.elts]
elif ast_obj_type is ast.Dict: