本文整理汇总了Python中model.user.User.user_timeline方法的典型用法代码示例。如果您正苦于以下问题:Python User.user_timeline方法的具体用法?Python User.user_timeline怎么用?Python User.user_timeline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.user.User
的用法示例。
在下文中一共展示了User.user_timeline方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_user_profile
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import user_timeline [as 别名]
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: get_user_status
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import user_timeline [as 别名]
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: test_remote_user_timeline
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import user_timeline [as 别名]
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: test_local_user_timeline
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import user_timeline [as 别名]
def test_local_user_timeline(self):
user = User(local_url='user/feed.xml')
timeline = user.user_timeline()
self.assertTrue(len(timeline) > 0)