When deleting a cable make sure the trace sees the cable as gone

This commit is contained in:
Sander Steffann 2019-10-20 00:10:05 +02:00
parent 84c9ef8144
commit 72f4ded24e

View File

@ -64,10 +64,10 @@ def nullify_connected_endpoints(instance, **kwargs):
instance.termination_b.save()
# Update all endpoints affected by this cable
update_endpoints(endpoints)
update_endpoints(endpoints, without_cable=instance)
def update_endpoints(endpoints):
def update_endpoints(endpoints, without_cable=None):
"""
Update all endpoints affected by this cable
"""
@ -75,6 +75,10 @@ def update_endpoints(endpoints):
if not hasattr(endpoint, 'connected_endpoint'):
continue
if endpoint.cable == without_cable:
# We collected the endpoints before deleting the cable, so trace with the cable removed
endpoint.cable = None
path = endpoint.trace()
# The trace returns left and right, we just want a single list