From bf89c4643c710bfbec6fd7e1495bbd536b1e5089 Mon Sep 17 00:00:00 2001 From: Adarnof Date: Thu, 25 Feb 2016 16:50:55 -0500 Subject: [PATCH] Change loglevel of validation errors --- registration/forms.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/registration/forms.py b/registration/forms.py index 34533811..8fcea113 100644 --- a/registration/forms.py +++ b/registration/forms.py @@ -15,29 +15,29 @@ class RegistrationForm(forms.Form): def clean(self): if ' ' in self.cleaned_data['username']: - logger.error("RegistrationForm username contains spaces. Raising ValidationError. Username: %s" % self.cleaned_data['username']) + logger.debug("RegistrationForm username contains spaces. Raising ValidationError. Username: %s" % self.cleaned_data['username']) raise forms.ValidationError(u'Username cannot contain a space') # We attempt to get the user object if we succeed we know email as been used try: User.objects.get(email=self.cleaned_data['email']) - logger.error("RegistrationForm email already registered. Raising ValidationError") + logger.debug("RegistrationForm email already registered. Raising ValidationError") raise forms.ValidationError(u'Email as already been used') except: pass if not re.match("^\w+$", self.cleaned_data['username']): - logger.error("RegistrationForm username contains non-alphanumeric characters. Raising ValueError. Username: %s" % self.cleaned_data['username']) + logger.debug("RegistrationForm username contains non-alphanumeric characters. Raising ValueError. Username: %s" % self.cleaned_data['username']) raise forms.ValidationError(u'Username contains illegal characters') if 'password' in self.cleaned_data and 'password_again' in self.cleaned_data: if self.cleaned_data['password'] != self.cleaned_data['password_again']: - logger.error("RegistrationForm password mismatch. Raising ValueError") + logger.debug("RegistrationForm password mismatch. Raising ValueError") raise forms.ValidationError(u'Passwords do not match') if 'email' in self.cleaned_data and 'email_again' in self.cleaned_data: if self.cleaned_data['email'] != self.cleaned_data['email_again']: - logger.error("RegistrationForm email mismatch. Raising ValidationError") + logger.debug("RegistrationForm email mismatch. Raising ValidationError") raise forms.ValidationError(u'Emails do not match') return self.cleaned_data