Commit b9358f3f authored by Daniel W Bond's avatar Daniel W Bond
Browse files

catch exception if student is not in peoplefinder

parent 4847de4b
...@@ -17,8 +17,12 @@ def pfinfo(u_name): ...@@ -17,8 +17,12 @@ def pfinfo(u_name):
print e print e
else: else:
pf_json = metadata.json() pf_json = metadata.json()
name = pf_json['results'][0]['name'] try:
return name.split(',') name = pf_json['results'][0]['name']
return name.split(',')
# if the name is not in peoplefinder, return empty first and last name
except IndexError:
return ['', '']
def create_user(tree): def create_user(tree):
......
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