本文整理汇总了Python中myapp.ApiObject.ApiObject.create_user_object方法的典型用法代码示例。如果您正苦于以下问题:Python ApiObject.create_user_object方法的具体用法?Python ApiObject.create_user_object怎么用?Python ApiObject.create_user_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myapp.ApiObject.ApiObject
的用法示例。
在下文中一共展示了ApiObject.create_user_object方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: user_get_profile
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import create_user_object [as 别名]
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: bookmark_get_app_user_list
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import create_user_object [as 别名]
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: get
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import create_user_object [as 别名]
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: user_list_to_user_object_list
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import create_user_object [as 别名]
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: get_ranking
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import create_user_object [as 别名]
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: bookmark_get_thread_user_list
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import create_user_object [as 别名]
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: user_get_user
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import create_user_object [as 别名]
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)