Exemple #1
0
	def search(self,searchkey):
		files=self.db.query(File.fileid,File.title,File.path,File.create).filter(File.title.like(u"%"+searchkey+"%"))
		arr=[]
		for file in files:
			filepath=os.path.join(STATIC_PATH,file[2])
			dic=BTCode.decodepath(filepath)
			dic['fileid']=file[0]
			dic['title']=file[1]
			arr.append(dic)
		self.render('search.html',files=arr)
Exemple #2
0
	def showFile(self,fileid):
		files=self.db.query(File.path,File.title,File.fileid).filter(File.fileid==fileid)
		if files.count==0:
			self.render('detail.html',file={})
		else:
			file=files[0]
			filepath=os.path.join(STATIC_PATH,file[0])
			dic=BTCode.decodepath(filepath)
			dic['title']=file[1]
			dic['fileid']=file[2]
			self.render('detail.html',file=dic)