Skip to content

Commit 7f2d544

Browse files
committed
Decouple direct access to pubsub structures from the webapp
1 parent 251289c commit 7f2d544

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pubsub/webapp.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,15 @@ def verify_user_exists(user):
6464
@view('user')
6565
def show_user_page(user):
6666
verify_user_exists(user)
67-
return dict(user=user, posts=pubsub.user_posts[user], heading="Recent posts", comb=comb)
67+
posts = pubsub.posts_by_user(user, limit=10)
68+
return dict(user=user, posts=posts, heading="Recent posts", comb=comb)
6869

6970
@get('/<user>/followers')
7071
@view('follow')
7172
def show_followers(user):
7273
verify_user_exists(user)
7374
return dict(
74-
users = pubsub.followers[user],
75+
users = pubsub.get_followers(user),
7576
who_does_what = f'Who follows {user}',
7677
comb = comb,
7778
)
@@ -81,7 +82,7 @@ def show_followers(user):
8182
def show_following(user):
8283
verify_user_exists(user)
8384
return dict(
84-
users = pubsub.following[user],
85+
users = pubsub.get_followed(user),
8586
who_does_what = f'Who {user} is following',
8687
comb = comb,
8788
)

0 commit comments

Comments
 (0)