本文整理匯總了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}