mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 12:06:53 -06:00
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
This commit is contained in:
parent
1349a25e34
commit
e7f689bc52
@ -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 [dict.get(i, key) for i in obj]
|
||||
|
||||
return dict.get(obj, 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
|
||||
|
Loading…
Reference in New Issue
Block a user