當前位置: 首頁>>代碼示例>>Python>>正文


Python Feed.update_video_score方法代碼示例

本文整理匯總了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}
開發者ID:Sonnbc,項目名稱:videolinks,代碼行數:12,代碼來源:views.py

示例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}
開發者ID:Sonnbc,項目名稱:videolinks,代碼行數:26,代碼來源:views.py


注:本文中的feed.Feed.update_video_score方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。