예제 #1
0
파일: ApiUser.py 프로젝트: abars/illustbook
	def user_get_profile(req,user_id,bookmark=None):
		if(not bookmark):
			bookmark=ApiObject.get_bookmark_of_user_id(user_id)
		if(not bookmark):
			return []
		one_dic=ApiObject.create_user_object(req,bookmark)
		one_dic["profile"]=bookmark.profile
		return one_dic
예제 #2
0
	def bookmark_get_app_user_list(req):
		thread_key=req.request.get("app_key")
		bookmark_list=Bookmark.all().filter("app_key_list =",db.Key(thread_key)).fetch(limit=100)
		dic=[]
		for bookmark in bookmark_list:
			one_dic=ApiObject.create_user_object(req,bookmark)
			dic.append(one_dic)
		return dic
예제 #3
0
	def get(self):
		is_iphone=CssDesign.is_iphone(self)

		page=1
		page_unit=20
		if(self.request.get("page")):
			page=int(self.request.get("page"))
		
		rank=Ranking.get_or_insert(BbsConst.THREAD_RANKING_KEY_NAME)
		ranking_mode=self.request.get("mode")
		
		ranking_id_list=rank.user_id_ranking_list[(page-1)*page_unit:page*page_unit]
		ranking_list=[]
		for user_id in ranking_id_list:
			obj=ApiObject.get_bookmark_of_user_id(user_id)
			if(obj):
				if(obj.disable_rankwatch):
					ranking_list.append(None)
					continue
				obj=ApiObject.create_user_object(self,obj)
				ranking_list.append(obj)

		user = users.get_current_user()
		user_rank=0
		if(user):
			rank=Ranking.get_by_key_name(BbsConst.THREAD_RANKING_KEY_NAME)
			if(rank):
				user_rank=rank.get_user_rank(user.user_id())

		template_values = {
			'host': "./",
			'is_iphone': is_iphone,
			'user': user,
			'user_rank': user_rank,
			'redirect_url': self.request.path,
			'mode': "ranking",
			'header_enable': False,
			'ranking_list': ranking_list,
			'ranking_mode': ranking_mode,
			'page': page,
			'page_unit': page_unit
		}

		path = '/html/portal.html'
		self.response.out.write(template_select.render(path, template_values))
예제 #4
0
파일: ApiUser.py 프로젝트: abars/illustbook
	def user_list_to_user_object_list(req,user_list,fast):
		#ユーザIDだけの高速版
		if(fast):
			dic=[]
			for one_user in user_list:
				one_dic=ApiObject.create_user_object_fast(req,one_user)
				dic.append(one_dic)
			return dic
		
		#名前などを含んだ低速版
		bookmark_list=ApiObject.get_bookmark_list(user_list)
		dic=[]
		for one_user in user_list:
			bookmark=bookmark_list[one_user]
			if(bookmark):
				one_dic=ApiObject.create_user_object(req,bookmark)
				dic.append(one_dic)
		return dic
예제 #5
0
 def get_ranking(req):
     app_key = req.request.get("app_key")
     data_key = req.request.get("data_key")
     order = req.request.get("order")
     query = ApiPerpetuationData.all()
     query.filter("app_key =", db.get(app_key))
     query.filter("data_key =", data_key)
     if order == "ascending":
         query.order("int_data")
         query.filter("int_data !=", 0)
     else:
         query.order("-int_data")
     data_list = query.fetch(limit=10, offset=0)
     dic = []
     for data in data_list:
         one_user = data.user_id
         bookmark = ApiObject.get_bookmark_of_user_id(one_user)
         if bookmark:
             one_dic = ApiObject.create_user_object(req, bookmark)
             one_dic["text_data"] = data.text_data
             one_dic["int_data"] = data.int_data
             dic.append(one_dic)
     dic = {"status": "success", "message": "", "response": dic}
     return dic
예제 #6
0
	def bookmark_get_thread_user_list(req):
		thread_key=req.request.get("thread_key")
		bookmark_list=Bookmark.all().filter("thread_key_list =",db.Key(thread_key)).fetch(limit=100)
		
		#comment
		comment={}
		thread=ApiObject.get_cached_object(db.Key(thread_key))
		if(not thread):
			return []
		if(thread.bookmark_comment):
			comment=pickle.loads(thread.bookmark_comment)

		#user list
		dic=[]
		for bookmark in bookmark_list:
			one_dic=ApiObject.create_user_object(req,bookmark)
			user_id=None
			if(one_dic.has_key("user_id")):
				user_id=one_dic["user_id"]
			if(user_id and comment.has_key(user_id)):
				one_dic["comment"]=comment[user_id]
			dic.append(one_dic)

		return dic
예제 #7
0
파일: ApiUser.py 프로젝트: abars/illustbook
	def user_get_user(req,user_id,bookmark=None):
		if(not bookmark):
			bookmark=ApiObject.get_bookmark_of_user_id(user_id)
		if(not bookmark):
			return []
		return ApiObject.create_user_object(req,bookmark)