1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Improve documentation and testing for conditions

This commit is contained in:
jeremystretch
2021-11-03 14:02:43 -04:00
parent 839afe5ac0
commit dcececf9c0
3 changed files with 50 additions and 3 deletions

View File

@@ -64,7 +64,11 @@ class Condition:
"""
Evaluate the provided data to determine whether it matches the condition.
"""
value = functools.reduce(dict.get, self.attr.split('.'), data)
try:
value = functools.reduce(dict.get, self.attr.split('.'), data)
except TypeError:
# Invalid key path
value = None
result = self.eval_func(value)
if self.negate: