Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: '>=' not supported between instances of 'NoneType' and 'int' #2617

Closed
ukanga opened this issue Jun 24, 2024 · 0 comments · Fixed by #2618
Closed

TypeError: '>=' not supported between instances of 'NoneType' and 'int' #2617

ukanga opened this issue Jun 24, 2024 · 0 comments · Fixed by #2618
Labels

Comments

@ukanga
Copy link
Member

ukanga commented Jun 24, 2024

Environmental Information

  • Onadata version: 3.17.2 or newer

Problem description

An exception is thrown when the attempts value from the cache is cleared. This could happen if the value is removed between lines 307 and 311. A further check is necessary before comparison on line 312.

TypeError: '>=' not supported between instances of 'NoneType' and 'int'
(9 additional frame(s) were not displayed)
...
  File "onadata/libs/authentication.py", line 113, in authenticate
    attempts = login_attempts(request)
  File "onadata/libs/authentication.py", line 312, in login_attempts
    if attempts >= getattr(settings, "MAX_LOGIN_ATTEMPTS", 10):

Expected behaviour

No exception thrown.

Steps to reproduce the behavior

Difficult to replicate unless in debugging or with mock testing.

Additional Information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant