From 8c8797599baa1601af52c6f8b570026ea840fcc2 Mon Sep 17 00:00:00 2001 From: Petr Voronov Date: Fri, 4 Jul 2025 10:19:22 +0300 Subject: [PATCH] Fixes #19633. Handle case that was the reason of TypeError and raise exeption: "TypeError: argument of type 'NoneType' is not iterable" with lead to breaking all events in the same object_type. --- netbox/extras/conditions.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/netbox/extras/conditions.py b/netbox/extras/conditions.py index 5680be444..8dec541bd 100644 --- a/netbox/extras/conditions.py +++ b/netbox/extras/conditions.py @@ -59,6 +59,7 @@ class Condition: if op not in self.TYPES[type(value)]: raise ValueError(_("Invalid type for {op} operation: {value}").format(op=op, value=type(value))) + self.op = op self.attr = attr self.value = value self.eval_func = getattr(self, f'eval_{op}') @@ -79,7 +80,12 @@ class Condition: except TypeError: # Invalid key path value = None - result = self.eval_func(value) + if value is None: + # Hande comparison case when value is None. + if self.op in (self.GT, self.GTE, self.LT, self.LTE, self.IN, self.CONTAINS, self.REGEX): + result = False + else: + result = self.eval_func(value) if self.negate: return not result