mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-09 00:58:16 -06:00
Addressed PR comments.
This commit is contained in:
parent
3df04efecc
commit
270bd53301
@ -135,12 +135,12 @@ class ConditionSet:
|
||||
def __init__(self, ruleset):
|
||||
if type(ruleset) is not dict:
|
||||
raise ValueError(_("Ruleset must be a dictionary, not {ruleset}.").format(ruleset=type(ruleset)))
|
||||
|
||||
print(len(ruleset))
|
||||
if len(ruleset) == 1:
|
||||
self.logic = (list(ruleset.keys())[0]).lower()
|
||||
if self.logic not in (AND, OR):
|
||||
raise ValueError(
|
||||
f"Invalid logic type: {self.logic} (must be '{AND}' or '{OR}'). Please check documentation.")
|
||||
raise ValueError(_(
|
||||
f"Invalid logic type: {self.logic} (must be 'AND' or 'OR'). Please check documentation."))
|
||||
|
||||
# Compile the set of Conditions
|
||||
self.conditions = [
|
||||
@ -152,7 +152,7 @@ class ConditionSet:
|
||||
self.logic = None
|
||||
self.conditions = [Condition(**ruleset)]
|
||||
except TypeError:
|
||||
raise ValueError(f"Incorrect key(s) informed. Please check documentation.")
|
||||
raise ValueError(_("Incorrect key(s) informed. Please check documentation."))
|
||||
|
||||
def eval(self, data):
|
||||
"""
|
||||
|
@ -13,7 +13,6 @@ from dcim.choices import SiteStatusChoices
|
||||
from dcim.models import Site
|
||||
from extras.choices import EventRuleActionChoices, ObjectChangeActionChoices
|
||||
from extras.events import enqueue_object, flush_events, serialize_for_event
|
||||
from extras.forms import SavedFilterForm, EventRuleForm
|
||||
from extras.models import EventRule, Tag, Webhook
|
||||
from extras.webhooks import generate_signature, send_webhook
|
||||
from utilities.testing import APITestCase
|
||||
|
Loading…
Reference in New Issue
Block a user