本文整理汇总了Python中myapp.ApiObject.ApiObject.get_bookmark_of_user_id方法的典型用法代码示例。如果您正苦于以下问题:Python ApiObject.get_bookmark_of_user_id方法的具体用法?Python ApiObject.get_bookmark_of_user_id怎么用?Python ApiObject.get_bookmark_of_user_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myapp.ApiObject.ApiObject
的用法示例。
在下文中一共展示了ApiObject.get_bookmark_of_user_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_portal
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [as 别名]
def show_portal(self,user):
self.redirect("./?order=chat")
return
is_iphone=CssDesign.is_iphone(self)
is_tablet=CssDesign.is_tablet(self)
show_room=Chat.get_room_object_list()
is_admin=False
if(OwnerCheck.is_admin(user)):
is_admin=True
#user_name=self.get_user_name(user)
bookmark=None
if(user):
bookmark=ApiObject.get_bookmark_of_user_id(user.user_id())
template_values = {
'host': "./",
'is_iphone': is_iphone,
'is_tablet': is_tablet,
'bookmark': bookmark,
'redirect_url': self.request.path,
'mode': "chat",
'header_enable': False,
'room_list': show_room,
'is_admin':is_admin,
#'user_name': user_name,
'is_english':CssDesign.is_english(self)
}
path = '/html/portal.html'
self.response.out.write(template_select.render(path, template_values))
示例2: user_get_profile
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [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
示例3: is_following
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [as 别名]
def is_following(user,user_id,view_mode):
if(view_mode):
if(user):
my_bookmark=ApiObject.get_bookmark_of_user_id(user.user_id())
if(my_bookmark):
if(user_id in my_bookmark.user_list):
return True
return False
示例4: get_user_name
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [as 别名]
def get_user_name(user):
if (not user):
return ""
user_id = user.user_id()
bookmark = ApiObject.get_bookmark_of_user_id(user_id)
if (not bookmark):
return ""
return bookmark.name
示例5: get_user_name
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [as 别名]
def get_user_name(self,user):
if(user):
bookmark=ApiObject.get_bookmark_of_user_id(user.user_id())
else:
bookmark=None
user_name="名無しさん"
if(bookmark and bookmark.name and bookmark.name!="None"):
user_name=bookmark.name
return user_name
示例6: user_get_is_submit_moper_exist
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [as 别名]
def user_get_is_submit_moper_exist(req,user_id,bookmark=None):
if(not bookmark):
bookmark=ApiObject.get_bookmark_of_user_id(user_id)
if(not bookmark):
return 0
if(bookmark.submit_moper_count is None):
cnt=ApiUser._get_submit_illust_count(user_id,bookmark,BbsConst.ILLUSTMODE_MOPER)
bookmark.submit_moper_count=cnt
bookmark.put()
return bookmark.submit_moper_count
示例7: user_get_home_timeline
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [as 别名]
def user_get_home_timeline(req,user_id):
#そのユーザのフォローしているユーザのタイムライン
bookmark=ApiObject.get_bookmark_of_user_id(user_id)
if(bookmark==None):
return []
feed_key_list=ApiObject.offset_and_limit(req,bookmark.stack_feed_list)
feed_list=ApiObject.get_cached_object_list(feed_key_list)
dic=ApiObject.create_feed_object_list(req,feed_list,feed_key_list)
return dic
示例8: bookmark_get_app_list
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [as 别名]
def bookmark_get_app_list(req,user_id):
bookmark=ApiObject.get_bookmark_of_user_id(user_id)
if(bookmark==None):
return []
dic=[]
for app_key in bookmark.app_key_list:
app=db.get(app_key)
one_dic=ApiObject.create_app_object(req,app)
dic.append(one_dic)
return dic
示例9: new_feed_count
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [as 别名]
def new_feed_count(obj):
#return 1
if(not obj):
return 0
#if(type(obj)==Bookmark):
# bookmark=obj
#else:
bookmark=ApiObject.get_bookmark_of_user_id(str(obj.user_id()))
if(not bookmark):
return 0
if(not bookmark.new_feed_count):
return 0
return bookmark.new_feed_count
示例10: bookmark_get_thread_list
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [as 别名]
def bookmark_get_thread_list(req,user_id,bookmark=None):
if(not bookmark):
bookmark=ApiObject.get_bookmark_of_user_id(user_id)
if(bookmark==None):
return []
thread_key_list=bookmark.thread_key_list
thread_key_list=ApiObject.offset_and_limit(req,thread_key_list)
dic=ApiObject.create_thread_object_list(req,thread_key_list,"bookmark")
ApiBookmark.add_removed_thread_to_dic(req,dic,thread_key_list)
return dic
示例11: regulation_check
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [as 别名]
def regulation_check(thread,user):
adult=_get_adult(thread)
if(not adult):
return True
if(not user):
return False
bookmark=ApiObject.get_bookmark_of_user_id(user.user_id())
if(not bookmark):
return False
if(not bookmark.regulation):
return False
if(adult & bookmark.regulation):
return True #表示
return False
示例12: get
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [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))
示例13: _bookmark_get_bbs_list_core
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [as 别名]
def _bookmark_get_bbs_list_core(req,user_id,mute):
bookmark=ApiObject.get_bookmark_of_user_id(user_id)
if(bookmark==None):
return []
dic=[]
if(mute):
bbs_key_list=bookmark.get_mute_bbs_list()
else:
bbs_key_list=bookmark.bbs_key_list
bbs_list=ApiObject.get_cached_object_list(bbs_key_list)
for bbs in bbs_list:
one_dic=ApiObject.create_bbs_object(req,bbs)
if(one_dic):
dic.append(one_dic)
ApiBookmark.add_removed_bbs_to_dic(req,dic,bbs_key_list)
return dic
示例14: _get_tweet_list
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [as 别名]
def _get_tweet_list(page):
cache_id=BbsConst.OBJECT_CACHE_HEADER+BbsConst.OBJECT_TWEET_LIST_HEADER
if(page==1):
cache=memcache.get(cache_id)
if(cache):
return cache
first_page_show_n=10
if(page==1):
unit=50 #非表示ユーザもいるので多めにとってくる
offset=0
else:
unit=50
offset=unit*(page-2)+first_page_show_n
query=db.Query(StackFeedData,keys_only=False).filter("feed_mode = ","message").order("-create_date")
try:
tweet_list=query.fetch(limit=unit,offset=offset)
except:
tweet_list=None
cnt=0
tweet_list_removed=[]
for tweet in tweet_list:
bookmark=ApiObject.get_bookmark_of_user_id(tweet.from_user_id)
if(bookmark):
if(not bookmark.disable_global_tweet):
tweet_list_removed.append(tweet)
cnt=cnt+1
if(page==1 and cnt>=first_page_show_n):
break
if(page==1):
memcache.set(cache_id,tweet_list_removed,BbsConst.OBJECT_TWEET_LIST_CACHE_TIME)
return tweet_list_removed
示例15: get_user_list
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import get_bookmark_of_user_id [as 别名]
def get_user_list(self):
try:
room=ChatRoom.get(self.request.get("key"))#db.get(str(self.request.get("key")))
except:
ApiObject.write_json_core(self,{"status":"failed"})
return
if(room==None):
ApiObject.write_json_core(self,{"status":"not_found"})
return
dic={}
for client in room.channel_client_list:
user_id=client.split("_")[0]
name="unknown"
bookmark=ApiObject.get_bookmark_of_user_id(user_id)
if(bookmark):
name=bookmark.name
name=str(client.split("_")[2]).replace("-","%")
name=urllib.unquote_plus(name)
dic[client]=name
ApiObject.write_json_core(self,{"status":"success","user_list":dic});