From 4c5bba46767f38d0296cb437c7565d391ef4e1f2 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Thu, 11 Mar 2010 18:56:15 +0000 Subject: [PATCH] Fixed issues with latest patches --- sso/forms.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sso/forms.py b/sso/forms.py index f24f025..f024ec1 100644 --- a/sso/forms.py +++ b/sso/forms.py @@ -33,7 +33,7 @@ class ServiceUsernameField(forms.CharField): field = super(ServiceUsernameField, self).clean(request) # Checks that usernames consist of letters and numbers only - if not re.match("^[A-Za-z0-9_-]*$", username): + if not re.match("^[A-Za-z0-9_-]*$", field): raise forms.ValidationError("Invalid character in username, use letters and numbers only") def UserServiceAccountForm(user): @@ -50,11 +50,12 @@ def UserServiceAccountForm(user): def clean(self): try: - acc = ServiceAccount.objects.get(service_uid=self.cleaned_data['username'],service==self.cleaned_data['service']) + acc = ServiceAccount.objects.get(service_uid=self.cleaned_data['username'],service=self.cleaned_data['service']) except ServiceAccount.DoesNotExist: pass else: raise forms.ValidationError("That username is already taken") + return self.cleaned_data return ServiceAccountForm