mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 09:16:10 -06:00
fixes incorrectly handled type error when list of objects is found in data #9876
This commit is contained in:
parent
e96cfadd22
commit
cdbb3827fe
@ -65,8 +65,14 @@ class Condition:
|
|||||||
"""
|
"""
|
||||||
Evaluate the provided data to determine whether it matches the 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:
|
try:
|
||||||
value = functools.reduce(dict.get, self.attr.split('.'), data)
|
value = functools.reduce(_get, self.attr.split('.'), data)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# Invalid key path
|
# Invalid key path
|
||||||
value = None
|
value = None
|
||||||
|
Loading…
Reference in New Issue
Block a user