|
|
|
|
|
by Volpe
5439 days ago
|
|
That's an exceptional circumstance, the iterator is not responsible for knowing whether you have reached the end of the collection. You could achieve it by catering for these cases in your logic
if user.authorize(email, pass):
... success ...
else:
... fail ... rather than
try:
user.authorize(email, pass)
... success ...
except WrongPasswordException:
... fail ... |
|
User.authorize(username, password) -> Returns true if valid username/password -> Returns false if username/password do not match -> Raises AccountDisabled if username/password valid but account disabled
The normal login failure case is not exceptional - but the others are.