Skip to content

Commit

Permalink
Guard against None value of User.email attribute
Browse files Browse the repository at this point in the history
If email was not specified during User creation (it's not required),
it will be `None`. It would be safer to guard against already existing
`None` values than to prevent creating new user with email == `None`.

Change-Id: Id81a94491918190ceae4b08cd3293250bb4ab194
Closes-Bug: #1383630
  • Loading branch information
Timur Sufiev committed Oct 29, 2014
1 parent f97a650 commit 89ee107
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion openstack_dashboard/dashboards/identity/groups/tables.py
Expand Up @@ -131,7 +131,7 @@ def filter(self, table, users, filter_string):
q = filter_string.lower()
return [user for user in users
if q in user.name.lower()
or q in getattr(user, 'email', '').lower()]
or q in (getattr(user, 'email', None) or '').lower()]


class RemoveMembers(tables.DeleteAction):
Expand Down
2 changes: 1 addition & 1 deletion openstack_dashboard/dashboards/identity/users/tables.py
Expand Up @@ -156,7 +156,7 @@ def filter(self, table, users, filter_string):
q = filter_string.lower()
return [user for user in users
if q in user.name.lower()
or q in getattr(user, 'email', '').lower()]
or q in (getattr(user, 'email', None) or '').lower()]


class UsersTable(tables.DataTable):
Expand Down

0 comments on commit 89ee107

Please sign in to comment.