Fixed a bug where rate limiting values were not checked against the lowest value...
authorLeonidas Poulopoulos <leopoul@noc.grnet.gr>
Wed, 21 Dec 2011 14:08:23 +0000 (16:08 +0200)
committerLeonidas Poulopoulos <leopoul@noc.grnet.gr>
Wed, 21 Dec 2011 14:08:23 +0000 (16:08 +0200)
flowspec/forms.py
flowspec/models.py
templates/apply.html

index a8aac49..34e0780 100644 (file)
@@ -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')
index 18c93cc..ebfaebf 100644 (file)
@@ -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)
index f11f6ad..e48270f 100644 (file)
@@ -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>