diff options
Diffstat (limited to 'rpkid/rpki/gui/app/forms.py')
-rw-r--r-- | rpkid/rpki/gui/app/forms.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/rpkid/rpki/gui/app/forms.py b/rpkid/rpki/gui/app/forms.py index 80439b00..68bd0a3f 100644 --- a/rpkid/rpki/gui/app/forms.py +++ b/rpkid/rpki/gui/app/forms.py @@ -319,16 +319,16 @@ def AddNetForm(qsv4, qsv6): def clean_address_range(self): address_range = self.cleaned_data.get('address_range') try: - r = resource_range_ipv4.parse_str(address_range) - if not qsv4.filter(prefix_min__lte=r.min, prefix_max__gte=r.max).exists(): - raise forms.ValidationError('IP address range is not delegated to you') - except BadIPResource: - try: + if ':' in address_range: r = resource_range_ipv6.parse_str(address_range) if not qsv6.filter(prefix_min__lte=r.min, prefix_max__gte=r.max).exists(): raise forms.ValidationError('IP address range is not delegated to you') - except BadIPResource: - raise forms.ValidationError('invalid IP address range') + else: + r = resource_range_ipv4.parse_str(address_range) + if not qsv4.filter(prefix_min__lte=r.min, prefix_max__gte=r.max).exists(): + raise forms.ValidationError('IP address range is not delegated to you') + except BadIPResource: + raise forms.ValidationError('invalid IP address range') return str(r) return _wrapped |