mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -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.
|
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:
|
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