Commit 0c7199da authored by Nicholas Anderson's avatar Nicholas Anderson

FIXED THE STUFF

parent 3b91ebb2
Pipeline #367 passed with stage
in 5 minutes and 14 seconds
......@@ -38,12 +38,22 @@ def pfinfo(uname):
pfjson = metadata.json()
try:
if len(pfjson['results']) == 1:
name_str = pfjson['results'][0]['name']
name = pfparse(name_str)
if pfjson['method'] == 'peoplefinder':
name_str = pfjson['results'][0]['name']
name = pfparse(name_str)
elif pfjson['method'] == 'ldap':
name = [pfjson['results'][0]['givenname'], pfjson['results'][0]['surname']]
else:
name = pfjson['results'][0]['name']
return name
else:
name_str = pfjson['results'][1]['name']
name = pfparse(name_str)
if pfjson['method'] == 'peoplefinder':
name_str = pfjson['results'][1]['name']
name = pfparse(name_str)
elif pfjson['method'] == 'ldap':
name = [pfjson['results'][1]['givenname'], pfjson['results'][1]['surname']]
else:
name = pfjson['results'][0]['name']
return name
# if the name is not in peoplefinder, return empty first and last name
except IndexError:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment