Commit e4fe56f664901be40a15e369134258114f9b9a64
Committed by
Sergio Oliveira
1 parent
e80461ab
Exists in
master
and in
39 other branches
Corrected empty checking for user and username
Signed-off-by: Carlos Oliveira <carlospecter@gmail.com> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
colab/accounts/auth.py
@@ -14,7 +14,7 @@ class ColabBrowserIDBackend(BrowserIDBackend): | @@ -14,7 +14,7 @@ class ColabBrowserIDBackend(BrowserIDBackend): | ||
14 | 14 | ||
15 | user = self.User.objects.filter(emails__address=email) | 15 | user = self.User.objects.filter(emails__address=email) |
16 | 16 | ||
17 | - if len(user) is not 0: | 17 | + if not user: |
18 | return user | 18 | return user |
19 | 19 | ||
20 | return self.User.objects.create_user( | 20 | return self.User.objects.create_user( |
colab/accounts/forms.py
@@ -58,7 +58,7 @@ class UserCreationForm(UserForm): | @@ -58,7 +58,7 @@ class UserCreationForm(UserForm): | ||
58 | def clean_username(self): | 58 | def clean_username(self): |
59 | username = self.cleaned_data['username'] | 59 | username = self.cleaned_data['username'] |
60 | username = username.strip() | 60 | username = username.strip() |
61 | - if len(username) is 0: | 61 | + if not username: |
62 | raise forms.ValidationError('This field should not be blank.') | 62 | raise forms.ValidationError('This field should not be blank.') |
63 | return username | 63 | return username |
64 | 64 |