From cdbb3827fe8c8c16f9dc0cf82ebc4589b185f271 Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Sat, 13 May 2023 02:19:24 +0530 Subject: [PATCH] fixes incorrectly handled type error when list of objects is found in data #9876 --- netbox/extras/conditions.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/netbox/extras/conditions.py b/netbox/extras/conditions.py index c6744e524..689479da1 100644 --- a/netbox/extras/conditions.py +++ b/netbox/extras/conditions.py @@ -65,8 +65,14 @@ class Condition: """ Evaluate the provided data to determine whether it matches the condition. """ + def _get(obj, key): + if isinstance(obj, list): + return [i.get(key) for i in obj] + + return obj.get(key) + try: - value = functools.reduce(dict.get, self.attr.split('.'), data) + value = functools.reduce(_get, self.attr.split('.'), data) except TypeError: # Invalid key path value = None