Exemplo n.º 1
0
	def get(self):
		"""Handles default langing page"""
#		print "xxxxxx"
		data = searchTags()
		topTrending = data.getSearchList(fetch=10)
		Cuser={}
		if self.logged_in:
			data = usersSearchs()
			yourTopTrending = data.getSearchList(userKey=self.current_user.key,)
			Cuser = {'user': self.current_user, 'session': self.auth.get_user_by_session(),}
			Cuser["yourTopTrending"]=[{'rowOBJ':itm,'keyWrd':itm.search.key().id_or_name(),"tags": itm.search.tags,"hits":itm.hits, "topList":(json.loads(itm.search.topList)[0] if len(json.loads(itm.search.topList))>0 else{})} for itm in  yourTopTrending]
		Cuser["topTrending"]=[{'rowOBJ':itm,'keyWrd':itm.key().id_or_name(),"tags": itm.tags,"hits":itm.hits, "topList":(json.loads(itm.topList)[0] if len(json.loads(itm.topList))>0 else {})} for itm in  topTrending]
		self.render('index.html',Cuser)
Exemplo n.º 2
0
	def post(self):
		"""Handles default langing page"""
#		print "xxxxxx"
		trackSearch = True if self.request.get("SearchHistory") == "1" else False
		search = self.request.get("Search").strip() if self.request.get("Search") else None
		topList = json.dumps(json.loads(self.request.get("topList"))) if self.request.get("topList") else "[]"
		if search:
			searchKeyOBJ = searchTags()
			searchKey =searchKeyOBJ.getSearchKey(search=search,updateCount=True,topList=topList)
			if self.logged_in and trackSearch and searchKey:
				usersSearchObj =usersSearchs()
				logging.info(self.current_user.key)
				logging.info(self.current_user.key.id())

				usersSearchObj.updateIntrest(search = searchKey ,user = self.current_user.key)