本文整理汇总了Python中feed.Feed.update_video_score方法的典型用法代码示例。如果您正苦于以下问题:Python Feed.update_video_score方法的具体用法?Python Feed.update_video_score怎么用?Python Feed.update_video_score使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类feed.Feed
的用法示例。
在下文中一共展示了Feed.update_video_score方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: vote_video
# 需要导入模块: from feed import Feed [as 别名]
# 或者: from feed.Feed import update_video_score [as 别名]
def vote_video(request):
user_id = request.authenticated_userid
vote = request.matchdict['vote']
video_id = int(request.matchdict['video_id'])
topic_id = DBHelper.get_video(video_id).topic_id
change = DBHelper.vote_video(user_id, video_id, vote)
feed = Feed()
feed.update_video_score(video_id, topic_id, change)
return {'change': change}
示例2: add_video
# 需要导入模块: from feed import Feed [as 别名]
# 或者: from feed.Feed import update_video_score [as 别名]
def add_video(request):
save_url = request.route_url('add_video')
topics = DBHelper.get_all_topics()
video = Video(title='', description='', url='', topic_id=0)
message = None
if 'form.submitted' in request.params:
title = request.params['title']
description = request.params['description']
url = request.params['url']
topic_id = request.params['topic']
user_id = request.authenticated_userid
video = Video(title=title, description=description, url=url,
owner_id=user_id, topic_id=topic_id)
if DBHelper.add_video(video):
feed = Feed()
feed.update_video_score(video_id, topic_id, 0)
return HTTPFound(location=request.route_url('home'))
else:
message = "Error while adding video"
return {'video':video, 'save_url':save_url,
'topics':topics, 'message':message}