aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/gui/app/forms.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2012-11-15 21:58:10 +0000
committerRob Austein <sra@hactrn.net>2012-11-15 21:58:10 +0000
commit11f3b8df179a16ebe1446dab620522ac97e3c327 (patch)
treec0af81a5987e9859d12a0323d0d240f58d8b2f36 /rpkid/rpki/gui/app/forms.py
parentc43c7100b22a6a203094c7143683e69b60eb425c (diff)
Pull from /trunk.
svn path=/branches/tk274/; revision=4877
Diffstat (limited to 'rpkid/rpki/gui/app/forms.py')
-rw-r--r--rpkid/rpki/gui/app/forms.py21
1 files changed, 4 insertions, 17 deletions
diff --git a/rpkid/rpki/gui/app/forms.py b/rpkid/rpki/gui/app/forms.py
index de7a8baf..2dfbb6a5 100644
--- a/rpkid/rpki/gui/app/forms.py
+++ b/rpkid/rpki/gui/app/forms.py
@@ -241,27 +241,12 @@ class ROARequest(forms.Form):
max_prefixlen = self.cleaned_data.get('max_prefixlen')
max_prefixlen = int(max_prefixlen) if max_prefixlen else r.prefixlen()
if max_prefixlen < r.prefixlen():
- raise forms.ValidationError('max prefix length must be greater than or equal to the prefix length')
+ raise forms.ValidationError(
+ 'max prefix length must be greater than or equal to the prefix length')
if max_prefixlen > r.datum_type.bits:
raise forms.ValidationError, \
'max prefix length (%d) is out of range for IP version (%d)' % (max_prefixlen, r.datum_type.bits)
-
- # verify that the request prefix is not already part of a
- # roarequest
- if models.ROARequestPrefix.objects.filter(
- roa_request__issuer=self.conf,
- roa_request__asn=self.cleaned_data.get('asn'),
- version='IPv%d' % (4 if isinstance(r, resource_range_ipv4) else 6,),
- prefix=str(r.min),
- prefixlen=r.prefixlen(),
- max_prefixlen=max_prefixlen
- ).exists():
- raise forms.ValidationError(
- 'this ROA request prefix already exists'
- )
-
self.cleaned_data['max_prefixlen'] = str(max_prefixlen)
-
return self.cleaned_data
@@ -325,6 +310,7 @@ def AddASNForm(child):
return _wrapped
+
def AddNetForm(child):
"""
Returns a forms.Form subclass which validates that the entered address
@@ -366,6 +352,7 @@ def AddNetForm(child):
return _wrapped
+
def ChildForm(instance):
"""
Form for editing a Child model.