예제 #1
0
def get_user_profile(username):
    """ Get the profile of the given user."""
    user = None
    user_dict = user_for_username(username)
    if user_dict is not None:
        user = User(local_url=user_dict['feed_location'])
    else:
        # User is remote.
        # TODO
        pass
    auth = True if 'user_id' in session else False
    return render_template('profile.html', user=user, posts=user.user_timeline(),
            page_type='profile', auth=auth)
예제 #2
0
def get_user_status(username, status_id):
    """ Get a given status by a given user. """
    user = None
    user_dict = user_for_username(username)
    if user_dict is not None:
        user = User(local_url=user_dict['feed_location'])
    else:
        # TODO
        pass
    posts = user.user_timeline()
    posts = [post for post in posts if post.guid == status_id]
    if len(posts) > 0:
        post = posts[0]
        return render_template('individual_post.html', user=user, status=post)
    else:
        # TODO 404
        pass
예제 #3
0
 def test_remote_user_timeline(self):
     user = User(remote_url='http://microblog.brianschrader.com/feed')
     timeline = user.user_timeline()
     self.assertTrue(len(timeline) > 0)
예제 #4
0
 def test_local_user_timeline(self):
     user = User(local_url='user/feed.xml')
     timeline = user.user_timeline()
     self.assertTrue(len(timeline) > 0)