From 15dfd887d00a5cac4df65834bb1a0ddc6db4580e Mon Sep 17 00:00:00 2001 From: yackob03 Date: Tue, 21 Jan 2014 17:43:47 -0500 Subject: [PATCH] Fix the user view in the prototype. --- endpoints/api.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/endpoints/api.py b/endpoints/api.py index 032cd692a..64519af41 100644 --- a/endpoints/api.py +++ b/endpoints/api.py @@ -542,13 +542,16 @@ def change_organization_details(orgname): abort(403) def prototype_view(proto, org_members): - if proto.delegate_user: - delegate_view = { - 'name': proto.delegate_user.username, - 'is_robot': proto.delegate_user.robot, + def prototype_user_view(user): + return { + 'name': user.username, + 'is_robot': user.robot, 'kind': 'user', - 'is_org_member': proto.delegate_user.username in org_members, + 'is_org_member': user.username in org_members, } + + if proto.delegate_user: + delegate_view = prototype_user_view(proto.delegate_user) else: delegate_view = { 'name': proto.delegate_team.name, @@ -556,7 +559,7 @@ def prototype_view(proto, org_members): } return { - 'activating_user': user_view(proto.activating_user), + 'activating_user': prototype_user_view(proto.activating_user), 'delegate': delegate_view, 'role': proto.role.name, 'id': proto.uuid,