Commit f12b3d54 authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos

Fixed a bug where rate limiting values were not checked against the lowest value. Closes #1804

parent 6d48c46c
......@@ -145,11 +145,11 @@ class ThenPlainForm(forms.ModelForm):
if action_value:
try:
assert(int(action_value))
if int(action_value) < 50:
raise forms.ValidationError('Rate-limiting cannot be < 50kbps')
return "%s" %self.cleaned_data["action_value"]
except:
raise forms.ValidationError('Rate-limiting should be an integer')
if int(action_value) < 50:
raise forms.ValidationError('Rate-limiting cannot be < 50kbps')
raise forms.ValidationError('Rate-limiting should be an integer < 50')
else:
raise forms.ValidationError('Cannot be empty')
......@@ -159,6 +159,7 @@ class ThenPlainForm(forms.ModelForm):
raise forms.ValidationError('Cannot select something other than rate-limit')
else:
return self.cleaned_data["action"]
class PortPlainForm(forms.ModelForm):
# action = forms.CharField(initial='rate-limit')
......
......@@ -75,6 +75,7 @@ class ThenAction(models.Model):
return ret.rstrip(":")
class Meta:
db_table = u'then_action'
unique_together = ("action", "action_value")
class Route(models.Model):
name = models.SlugField(max_length=128)
......
......@@ -148,7 +148,7 @@ th {
}
.accord_wrapper{
height: 100% !important;
height: 452px !important;
}
.help {
......@@ -229,7 +229,7 @@ th {
</table>
<div id='portsacc' style="width: 500px;">
<h3 style="padding: 0.5em 0.5em 0.5em 0.7em;">Advanced Settings (Ports)</h3>
<div class='accord_wrapper' style="height: 100% !important;">
<div class='accord_wrapper' style="height: 452px !important;">
Select source/destination port(s), or select common port(s) for both source/destination
<table>
<tr>
......
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