Commit 7a0ac0d1 authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos
Browse files

Fixed phrasing for overlapping rules

parent 6b747a1b
...@@ -111,12 +111,8 @@ class RouteForm(forms.ModelForm): ...@@ -111,12 +111,8 @@ class RouteForm(forms.ModelForm):
for route in existing_routes: for route in existing_routes:
if name != route.name: if name != route.name:
existing_url = reverse('edit-route', args=[route.name]) existing_url = reverse('edit-route', args=[route.name])
if IPNetwork(destination) in IPNetwork(route.destination): if IPNetwork(destination) in IPNetwork(route.destination) or IPNetwork(route.destination) in IPNetwork(destination):
raise forms.ValidationError('There is an exact %s rule, %s whose destination (%s) is supernet of (or the same as) network (%s).<br>To avoid overlapping try editing rule <a href=\'%s\'>%s</a>' %(route.status, route.name, route.destination, destination, existing_url, route.name)) raise forms.ValidationError('Found an exact %s rule, %s with destination prefix %s<br>To avoid overlapping try editing rule <a href=\'%s\'>%s</a>' %(route.status, route.name, route.destination, existing_url, route.name))
if IPNetwork(route.destination) in IPNetwork(destination):
raise forms.ValidationError('There is an exact %s rule, %s whose destination network (%s) belongs to the destination network %s.<br>To avoid overlapping try editing rule <a href=\'%s\'>%s</a>' %(route.status, route.name, route.destination, destination, existing_url, route.name))
return self.cleaned_data return self.cleaned_data
class ThenPlainForm(forms.ModelForm): class ThenPlainForm(forms.ModelForm):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment