def POST(self,id): data = web.input() page_info = PageInfo('Edit') ##return render.edit(default_video, default_user,page_info) ans, temp_video = infoDBserver.modify_video(id, videoName = data.video_name, intro = data.video_intro) ans2, temp_user = infoDBserver.get_user(session.get_user_id()) if ans2: current_user = transclass.user_trans(temp_user) else: raise web.nofound() if ans: current_video = transclass.video_trans(temp_video) page_info = PageInfo('Edit',message = '保存成功!') raise web.seeother('/video/'+str(current_video.id)) else: page_info = PageInfo('Edit',error = '保存失败,请再试!') return render.edit(current_video,current_user,page_info)
def POST(self, id): data = web.input() page_info = PageInfo('Edit') ##return render.edit(default_video, default_user,page_info) ans, temp_video = infoDBserver.modify_video(id, videoName=data.video_name, intro=data.video_intro) ans2, temp_user = infoDBserver.get_user(session.get_user_id()) if ans2: current_user = transclass.user_trans(temp_user) else: raise web.nofound() if ans: current_video = transclass.video_trans(temp_video) page_info = PageInfo('Edit', message='保存成功!') raise web.seeother('/video/' + str(current_video.id)) else: page_info = PageInfo('Edit', error='保存失败,请再试!') return render.edit(current_video, current_user, page_info)
def POST(self, encodedURL): uploadURL = base64.urlsafe_b64decode(str(encodedURL)) x = web.input(up_file={}) filename = x['up_file'].filename type1 = web.input().file_type key, err = fs.putFile(x['up_file'].file, uploadURL) if err != None: web.debug(err) raise web.seeother('/upload') # do something return web.debug(key) ans1, video = infoDBserver.insert_video(key, session.get_user_id()) ans2, video2 = infoDBserver.modify_video(video.videoId,videoName = filename, type = type1) ##waiting for type changing if ans2: raise web.seeother('/edit/'+str(video2.videoId)) else: raise web.seeother('/upload')
def POST(self, encodedURL): uploadURL = base64.urlsafe_b64decode(str(encodedURL)) x = web.input(up_file={}) filename = x['up_file'].filename type1 = web.input().file_type key, err = fs.putFile(x['up_file'].file, uploadURL) if err != None: web.debug(err) raise web.seeother('/upload') # do something return web.debug(key) ans1, video = infoDBserver.insert_video(key, session.get_user_id()) ans2, video2 = infoDBserver.modify_video(video.videoId, videoName=filename, type=type1) ##waiting for type changing if ans2: raise web.seeother('/edit/' + str(video2.videoId)) else: raise web.seeother('/upload')