API get_members: Return a dictionary of users, not a list of tuples.

I believe this should require no special work on deploy, since some
grepping of logs suggests we are not currently using this API query.

(imported from commit 240086f900c6680cbc90bf6a2f334a9e1f172df6)
This commit is contained in:
Tim Abbott 2013-06-24 14:34:45 -04:00
parent 400db86008
commit ce50812bca
2 changed files with 4 additions and 3 deletions

View File

@ -41,5 +41,5 @@ parser.add_option_group(humbug.generate_option_group(parser))
client = humbug.init_from_options(options) client = humbug.init_from_options(options)
for name, email in client.get_members()["members"]: for user in client.get_members()["members"]:
print name, email print user["full_name"], user["email"]

View File

@ -1319,7 +1319,8 @@ def json_get_members(request, user_profile):
return get_members_backend(request, user_profile) return get_members_backend(request, user_profile)
def get_members_backend(request, user_profile): def get_members_backend(request, user_profile):
members = [(profile.full_name, profile.email) for profile in \ members = [{"full_name": profile.full_name,
"email": profile.email} for profile in \
UserProfile.objects.select_related().filter(realm=user_profile.realm)] UserProfile.objects.select_related().filter(realm=user_profile.realm)]
return json_success({'members': members}) return json_success({'members': members})