mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-26 18:38:38 -06:00
Change to translation strings
This commit is contained in:
parent
47f3994f93
commit
7c913fecb7
@ -535,8 +535,9 @@ class CablePath(models.Model):
|
|||||||
|
|
||||||
# Ensure all originating terminations are attached to the same link
|
# Ensure all originating terminations are attached to the same link
|
||||||
if len(terminations) > 1:
|
if len(terminations) > 1:
|
||||||
assert all(t.link == terminations[0].link for t in terminations[1:]), \
|
assert all(t.link == terminations[0].link for t in terminations[1:]), (
|
||||||
"All originating terminations must start must be attached to the same link"
|
_("All originating terminations must start must be attached to the same link")
|
||||||
|
)
|
||||||
|
|
||||||
path = []
|
path = []
|
||||||
position_stack = []
|
position_stack = []
|
||||||
@ -547,13 +548,15 @@ class CablePath(models.Model):
|
|||||||
while terminations:
|
while terminations:
|
||||||
|
|
||||||
# Terminations must all be of the same type
|
# Terminations must all be of the same type
|
||||||
assert all(isinstance(t, type(terminations[0])) for t in terminations[1:]), \
|
assert all(isinstance(t, type(terminations[0])) for t in terminations[1:]), (
|
||||||
"All mid-span terminations must have the same termination type"
|
_("All mid-span terminations must have the same termination type")
|
||||||
|
)
|
||||||
|
|
||||||
# All mid-span terminations must all be attached to the same device
|
# All mid-span terminations must all be attached to the same device
|
||||||
if not isinstance(terminations[0], PathEndpoint):
|
if not isinstance(terminations[0], PathEndpoint):
|
||||||
assert all(t.parent_object == terminations[0].parent_object for t in terminations[1:]), \
|
assert all(t.parent_object == terminations[0].parent_object for t in terminations[1:]), (
|
||||||
"All mid-span terminations must have the same parent object"
|
_("All mid-span terminations must have the same parent object")
|
||||||
|
)
|
||||||
|
|
||||||
# Check for a split path (e.g. rear port fanning out to multiple front ports with
|
# Check for a split path (e.g. rear port fanning out to multiple front ports with
|
||||||
# different cables attached)
|
# different cables attached)
|
||||||
@ -576,8 +579,8 @@ class CablePath(models.Model):
|
|||||||
return None
|
return None
|
||||||
# Otherwise, halt the trace if no link exists
|
# Otherwise, halt the trace if no link exists
|
||||||
break
|
break
|
||||||
assert all(type(link) in (Cable, WirelessLink) for link in links), "All links must be cable or wireless"
|
assert all(type(link) in (Cable, WirelessLink) for link in links), _("All links must be cable or wireless")
|
||||||
assert all(isinstance(link, type(links[0])) for link in links), "All links must match first link type"
|
assert all(isinstance(link, type(links[0])) for link in links), _("All links must match first link type")
|
||||||
|
|
||||||
# Step 3: Record asymmetric paths as split
|
# Step 3: Record asymmetric paths as split
|
||||||
not_connected_terminations = [termination.link for termination in terminations if termination.link is None]
|
not_connected_terminations = [termination.link for termination in terminations if termination.link is None]
|
||||||
@ -654,14 +657,16 @@ class CablePath(models.Model):
|
|||||||
positions = position_stack.pop()
|
positions = position_stack.pop()
|
||||||
|
|
||||||
# Ensure we have a number of positions equal to the amount of remote terminations
|
# Ensure we have a number of positions equal to the amount of remote terminations
|
||||||
assert len(remote_terminations) == len(positions)
|
assert len(remote_terminations) == len(positions), (
|
||||||
|
_("All positions counts within the path on opposite ends of links must match")
|
||||||
|
)
|
||||||
|
|
||||||
# Get our front ports
|
# Get our front ports
|
||||||
q_filter = Q()
|
q_filter = Q()
|
||||||
for rt in remote_terminations:
|
for rt in remote_terminations:
|
||||||
position = positions.pop()
|
position = positions.pop()
|
||||||
q_filter |= Q(rear_port_id=rt.pk, rear_port_position=position)
|
q_filter |= Q(rear_port_id=rt.pk, rear_port_position=position)
|
||||||
assert q_filter is not Q(), "Remote termination query filter is empty, please open a bug report"
|
assert q_filter is not Q(), _("Remote termination query filter is empty, please open a bug report")
|
||||||
front_ports = FrontPort.objects.filter(q_filter)
|
front_ports = FrontPort.objects.filter(q_filter)
|
||||||
# Obtain the individual front ports based on the termination and position
|
# Obtain the individual front ports based on the termination and position
|
||||||
elif position_stack:
|
elif position_stack:
|
||||||
|
Loading…
Reference in New Issue
Block a user