コード例 #1
0
ファイル: applications.py プロジェクト: hyperpro/SoftPracPj
 def GET(self, id):
     page_info = PageInfo('Edit')
     ans1, temp_video = infoDBserver.get_video(id)
     ans2, temp_user = infoDBserver.get_user(session.get_user_id())
     if ans1 and ans2:
         current_video = transclass.video_trans(temp_video)
         current_user = transclass.user_trans(temp_user)
         return render.edit(current_video,current_user,page_info)
     else:
         raise web.nofound()
     return render.edit(current_video, current_user, page_info)
コード例 #2
0
 def GET(self, id):
     page_info = PageInfo('Edit')
     ans1, temp_video = infoDBserver.get_video(id)
     ans2, temp_user = infoDBserver.get_user(session.get_user_id())
     if ans1 and ans2:
         current_video = transclass.video_trans(temp_video)
         current_user = transclass.user_trans(temp_user)
         return render.edit(current_video, current_user, page_info)
     else:
         raise web.nofound()
     return render.edit(current_video, current_user, page_info)
コード例 #3
0
ファイル: applications.py プロジェクト: hyperpro/SoftPracPj
 def GET(self, id):
     page_info = PageInfo('Video')
     ans1, temp_video = infoDBserver.get_video(id)
     current_video = transclass.video_trans(temp_video)
     ans2, temp_user = infoDBserver.get_user(session.get_user_id())
     current_user = transclass.user_trans(temp_user)
     ans3, temp_user = infoDBserver.get_user(current_video.owner)
     video_owner = transclass.user_trans(temp_user)
     if ans1 and ans2 and ans3:
         return render.video(current_video,current_user,video_owner,page_info)
     else:
         raise web.nofound() 
コード例 #4
0
 def GET(self, id):
     page_info = PageInfo('Video')
     ans1, temp_video = infoDBserver.get_video(id)
     current_video = transclass.video_trans(temp_video)
     ans2, temp_user = infoDBserver.get_user(session.get_user_id())
     current_user = transclass.user_trans(temp_user)
     ans3, temp_user = infoDBserver.get_user(current_video.owner)
     video_owner = transclass.user_trans(temp_user)
     if ans1 and ans2 and ans3:
         return render.video(current_video, current_user, video_owner,
                             page_info)
     else:
         raise web.nofound()
コード例 #5
0
ファイル: applications.py プロジェクト: SunRunAway/SoftPracPj
    def getVideos(self, userId, limit=20): #use 20 as default limit of videos
        videos = []

        ans, user = infoDBserver.get_user(userId)
        if ans and user.videos != None:
            i = 0
            for element in user.videos:
                videos.append(transclass.video_trans(element))
                i += 1
                if i >= limit:
                    break

        return videos
コード例 #6
0
ファイル: applications.py プロジェクト: hyperpro/SoftPracPj
 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)
コード例 #7
0
 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)