Better code for 7535 fix
|Reported by:||leotr||Owned by:||nobody|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
- users = list(User.objects.filter(email=username)) - if len(users) == 1: - user = users - else: - # Either we cannot find the user, or if more than 1 - # we cannot guess which user is the correct one. - raise User.DoesNotExist()
I think that mine is more elegant. Just add
AssertionError to exception list.