From c27571f78e6f4515d0eb33fada0c40d394193b6d Mon Sep 17 00:00:00 2001 From: Michael Elkins Date: Mon, 12 Nov 2012 15:37:52 +0000 Subject: properly detect ipv6 addresses svn path=/trunk/; revision=4850 --- rpkid/rpki/gui/app/forms.py | 14 +++++++------- 1 file 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 -- cgit v1.2.3