Esempio n. 1
0
	def POST(self):
		chdir(path[0]+sep+'avinfo')
		render = template.render('templates/')
		f = updata_form();
		if not f.validates():
			return render.updata(f)
		aid = f.id.value
		c = connect()
		nav,ntitle,nupid,\
		ncreate_time,nplay_times,ncollects_count,\
		ndans_count,nreview_count,ncoin_count = \
		int(f.av.value),f.title.value,int(f.up.value),\
		str(f.create_time.value),int(f.play_times.value),int(f.collects_count.value),\
		int(f.dans_count.value),int(f.reviews_count.value),int(f.coins_count.value)
		insertdic = {}
		insertdic["av"] = nav
		insertdic["title"] = ntitle
		insertdic["up_id"] = nupid
		insertdic['create_stamp'] = ncreate_time
		insertdic["create_at"] = ncreate_time
		insertdic["play_times"] = nplay_times
		insertdic["collect_times"] = ncollects_count
		insertdic["dan_count"] = ndans_count
		insertdic["review_times"] = nreview_count
		insertdic['coins_count'] = ncoin_count
		print insertdic
		con = connect()
		result = insert_av_info(con,insertdic)
		if result == 403:
			f.up.note = "该up id不满足约束条件"
			return render.insert(f)
		return render.success('updata')
Esempio n. 2
0
	def POST(self):
		chdir(path[0]+sep+'avinfo')
		render = template.render('templates/')
		f = updata_form();
		if not f.validates():
			return render.updata(f)
		aid = f.id.value
		c = connect()
		avin = query_av_info(c,int(aid)-1,1)
		_,av,title,upid,up,create_time,play_times,collects_count,dans_count,\
		reviews_count,coins_count = avin[0]
		nav,ntitle,nupid,\
		ncreate_time,nplay_times,ncollects_count,\
		ndans_count,nreview_count,ncoin_count = \
		int(f.av.value),f.title.value,int(f.up.value),\
		str(f.create_time.value),int(f.play_times.value),int(f.collects_count.value),\
		int(f.dans_count.value),int(f.reviews_count.value),int(f.coins_count.value)
		updadic = {}
		if nav != av:
			updadic["av"] = nav
		if ntitle != title:
			updadic["title"] = ntitle
		if nupid != upid:
			updadic["up_id"] = nupid
		if ncreate_time != str(create_time):
			updadic['create_stamp'] = ncreate_time
		if nplay_times != play_times:
			updadic["play_times"] = nplay_times
		if ncollects_count != collects_count:
			updadic["collect_times"] = ncollects_count
		if ndans_count != dans_count:
			updadic["dan_count"] = ndans_count
		if nreview_count != reviews_count:
			updadic["review_times"] = nreview_count
		if ncoin_count != coins_count:
			updadic['coins_count'] = ncoin_count
		if len(updadic) == 0:
			f.av.note = "don't change any thing!!"
			return render.updata(f)
		con = connect()
		result = update_av_info(con,updadic,aid)
		if result == 403:
			f.up.note = "该up id不满足约束条件"
			return render.updata(f)
		return render.success('updata')
Esempio n. 3
0
 def GET(self):
     userdata = webinput(did=0)
     did = userdata.did
     if did == 0 or did == "0":
         return 404
     else:
         c = connect()
         delete_av_info(c, did)
         chdir(path[0] + sep + "avinfo")
         render = template.render("templates/")
         return render.delete()
Esempio n. 4
0
	def POST(self):
		global session
		chdir(path[0]+sep+'index')
		render = template.render('templates/')
		fo = loginform()
		if session == None:session = webconfig._session
		if not fo.validates():
			return render.index(False,fo)
		else:
			name = fo["username"].value
			up = fo["password"].value
			tc = connect()
			dp = query_admin_user_password(tc,name)
			if dp == "":
				fo["username"].note = "username not exist"
				return render.index(False,fo)				
			if md5st(up) != dp:
				fo["password"].note = "Password incorrect"
				return render.index(False,fo)
			session.login = 1
			session.name = fo["username"].value
			# print session.login,session.name
			return render.index(True,fo)
Esempio n. 5
0
	def GET(self):
		user_data = webinput(aid=0)
		aid = user_data.aid
		if aid==0:return 404
		if aid!=0 and not aid.isdigit():return 404
		f = updata_form()
		c = connect()
		avin = query_av_info(c,int(aid)-1,1)
		_,av,title,upid,up,create_time,play_times,collects_count,dans_count,\
		reviews_count,coins_count = avin[0]
		f.id.set_value(_)
		f.av.set_value(av)
		f.title.set_value(title)
		f.up.set_value(upid)
		f.create_time.set_value(create_time)
		f.play_times.set_value(play_times)
		f.collects_count.set_value(collects_count)
		f.dans_count.set_value(dans_count)
		f.reviews_count.set_value(reviews_count)
		f.coins_count.set_value(coins_count)
		chdir(path[0]+sep+'avinfo')
		render = template.render('templates/')
		#totalCounts,pageSize,currentPage
		return render.updata(f)
Esempio n. 6
0
        "cc":"coins_count",
        "csa":"create_stamp desc",
        "pca":"play_times desc",
        "cta":"collect_times desc",
        "dca":"dan_count desc",
        "rca":"review_times desc",
        "cca":"coins_count desc",
        "":""
        }
        default_order = ['cs', 'pc', 'ct', 'dc', 'rc','cc']
        if order != '' and order not in all_order.keys():
            return 500
        if len(order) == 2:
            ind = default_order.index(order)
            default_order[ind] = order+'a'
        startitemid = (page -1)*splitlimit 

        c = connect()
        allcount = query_av_count(c)
        all_page = allcount/splitlimit

        c = connect()
        print startitemid,splitlimit,all_order[order]
        gotdata = query_av_info(c,startitemid,splitlimit,all_order[order])

        chdir(path[0]+sep+'avinfo')
        render = template.render('templates/')
        #totalCounts,pageSize,currentPage
        return render.index(gotdata,allcount,splitlimit,page,default_order,order)
    def POST(self):
        return None