File login.py
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Login / logout and forbidden views and forms.
"""
from datetime import datetime
Function login
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def login(context, request):
""" Login view. Renders either the login or password forgot form templates
or handles their form submission and redirects to came_from on success.
:result: Either a redirect response or a dictionary passed to the template
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function set_password
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def set_password(context, request, success_msg=_("You have reset your password.")):
""" Set password view. Displays the set password form and handles its form
submission.
:param context: Current context
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function register
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def register(context, request):
schema = RegisterSchema().bind(request=request)
form = Form(schema, buttons=(Button("register", _("Register")),))
rendered_form = None
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _find_user
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _find_user(login):
principals = get_principals()
principal = principals.get(login)
if principal is not None:
return principal
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"