Make the inlist_field operator work on identifiers so it has the same result as inlist

This commit is contained in:
Charles Haley 2024-10-23 22:43:28 +01:00
parent a4c4a8fa33
commit a2b38bd882

View File

@ -1403,9 +1403,14 @@ class _Interpreter:
if res is None or not isinstance(res, (list, tuple, set, dict)): if res is None or not isinstance(res, (list, tuple, set, dict)):
self.error(_("Field '{0}' is either not a field or not a list").format(right), prog.line_number) self.error(_("Field '{0}' is either not a field or not a list").format(right), prog.line_number)
pat = re.compile(left, flags=re.I) pat = re.compile(left, flags=re.I)
for v in res: if isinstance(res, dict): # identifiers
if re.search(pat, v): for k,v in res.items():
return '1' if re.search(pat, f'{k}:{v}'):
return '1'
else:
for v in res:
if re.search(pat, v):
return '1'
return '' return ''
def do_node_string_infix(self, prog): def do_node_string_infix(self, prog):