def getComments(self, videoId, limit=20): comments = [] ans, temp_comments = infoDBserver.get_commentByVideoId(videoId) if ans and temp_comments!=None: for element in temp_comments: comment = transclass.comment_trans(element) comments.append(comment) return comments
def getComments2(id): comments = [] ans, temp_comments = infoDBserver.get_commentByVideoId(id) if ans and temp_comments!=None: for element in temp_comments: comment = transclass.comment_trans(element) comments.append(comment) return ans, comments
def POST(self,id): data = web.input() currentuser_id = session.get_user_id() reply_userid = data.toId content = data.content ans, bigComment = infoDBserver.insert_comment(id, currentuser_id, reply_userid, content) if ans: success, bigVideo = infoDBserver.get_video(id) success0, bigUser = infoDBserver.get_user(currentuser_id) if success: success1, bigNotice = infoDBserver.insert_notice(currentuser_id, bigVideo.ownerId, 2, str(bigUser.userName)+' replied to your video', '/video/'+str(id)) if data.toId!=None: success2, bigNotice = infoDBserver.insert_notice(currentuser_id, data.toId, 2, str(bigUser.userName)+' replied to your comments in video '+str(bigVideo.videoName),'/video/'+str(id)) comments = [] comments.append(transclass.comment_trans(bigComment)) return_message = comment2json(True,comments) else: return_message = comment2json(False, None) return return_message