Skip to content

Commit

Permalink
[#2304] Change follower_list to return user dicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hammond committed Apr 23, 2012
1 parent 7c73209 commit ca8eb76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 6 additions & 1 deletion ckan/logic/action/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,12 @@ def follower_list(context, data_dict):
cursor = conn.execute(q)
results = []
for row in cursor:
results.append(table_dictize(row, context))
follower_id = row['follower_id']
assert row['follower_type'] == 'user', (
"Currently only users (and not other domain objects) are "
"supported as followers.")
user = model.User.get(follower_id)
results.append(model_dictize.user_dictize(user, context))
return results

def user_follower_list(context, data_dict):
Expand Down
7 changes: 1 addition & 6 deletions ckan/tests/functional/api/test_follow.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,7 @@ def test_user_follow_user(self):
followers = response['result']
assert len(followers) == 1
follower = followers[0]
assert follower['follower_id'] == self.annafan.id
assert follower['follower_type'] == 'user'
assert follower['followee_id'] == self.russianfan.id
assert follower['followee_type'] == 'user'
timestamp = datetime_from_string(follower['datetime'])
assert (timestamp >= before and timestamp <= after), str(timestamp)
assert follower['id'] == self.annafan.id

# Check that the user's follower count has increased by 1.
params = json.dumps({'id': self.russianfan.id})
Expand Down

0 comments on commit ca8eb76

Please sign in to comment.