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,6 +1403,11 @@ 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)
if isinstance(res, dict): # identifiers
for k,v in res.items():
if re.search(pat, f'{k}:{v}'):
return '1'
else:
for v in res: for v in res:
if re.search(pat, v): if re.search(pat, v):
return '1' return '1'