Skip to content

Commit e7f689b

Browse files
authored
Fixes incorrectly handled type error when list of objects is found in data (#12593)
* fixes incorrectly handled type error when list of objects is found in data #9876 * fixes incorrectly handled type error when list of objects is found in data #9876 * fixes incorrectly handled type error when list of objects is found in data #9876
1 parent 1349a25 commit e7f689b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

netbox/extras/conditions.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,14 @@ def eval(self, data):
6565
"""
6666
Evaluate the provided data to determine whether it matches the condition.
6767
"""
68+
def _get(obj, key):
69+
if isinstance(obj, list):
70+
return [dict.get(i, key) for i in obj]
71+
72+
return dict.get(obj, key)
73+
6874
try:
69-
value = functools.reduce(dict.get, self.attr.split('.'), data)
75+
value = functools.reduce(_get, self.attr.split('.'), data)
7076
except TypeError:
7177
# Invalid key path
7278
value = None

0 commit comments

Comments
 (0)