Skip to content
This repository was archived by the owner on Nov 8, 2018. It is now read-only.
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions app/main/views/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ def match_idp_email(idp, email_address):


def dept_from_idp_name(idp_name):
idp = [idp['name'] for idp in idp_profiles if idp_name == idp['idp_name']]
if idp:
return ' or '.join(idp)
return None
dept = [profile['name']
for profile in idp_profiles if idp_name == profile['idp_name']]
if dept:
return ' or '.join(dept)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arbitrary indentation level on line 101. But rather than using a list comprehension, consider using a for loop instead - list comprehensions are less readable. Also, since the callers of this function do not handle a None return value, the check on line 102 is redundant. Eg:

dept_names = []

for profile in idp_profiles:

    if idp_name == profile['idp_name']:
        dept_names.append(profile['name'])

return ' or '.join(dept_names)



def idp_for_dept(dept):
Expand Down Expand Up @@ -149,8 +149,8 @@ def authentication_request():

elif request.cookies.get('gateway_idp'):
session['suggested_idp'] = request.cookies.get('gateway_idp')
department = dept_from_idp_name(session['suggested_idp'])
session['department_name'] = department
session['department_name'] = dept_from_idp_name(
session['suggested_idp'])
return redirect(url_for('.confirm_dept'))

return redirect(url_for('.request_email_address'))
Expand Down