diff options
author | Michael Elkins <melkins@tislabs.com> | 2012-02-02 23:08:30 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2012-02-02 23:08:30 +0000 |
commit | bc6f1b82ef4fb8f094e6cf06fac987949d2f81e3 (patch) | |
tree | 5117a0af947f4c17eb37f4504aafd13a5333fccf /rpkid/rpki/gui/app/forms.py | |
parent | 9dda8df7ef73871b014caa780b6169852988e5c7 (diff) |
form validation must be prepared for None values in required fields
svn path=/branches/tk161/; revision=4283
Diffstat (limited to 'rpkid/rpki/gui/app/forms.py')
-rw-r--r-- | rpkid/rpki/gui/app/forms.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/rpkid/rpki/gui/app/forms.py b/rpkid/rpki/gui/app/forms.py index 65b84e89..97e3052c 100644 --- a/rpkid/rpki/gui/app/forms.py +++ b/rpkid/rpki/gui/app/forms.py @@ -124,7 +124,7 @@ class ChildWizardForm(forms.Form): def clean_handle(self): handle = self.cleaned_data.get('handle') - if (models.Conf.objects.filter(handle=handle).exists() or + if (handle and models.Conf.objects.filter(handle=handle).exists() or User.objects.filter(username=handle).exists()): raise forms.ValidationError('user already exists') return handle @@ -136,7 +136,7 @@ class ChildWizardForm(forms.Form): raise forms.ValidationError('passwords do not match') handle = self.cleaned_data.get('handle') parent = self.cleaned_data.get('parent') - if parent.children.filter(handle=handle).exists(): + if handle and parent and parent.children.filter(handle=handle).exists(): raise forms.ValidationError('parent already has a child by that name') return self.cleaned_data |