本文整理汇总了Python中myapp.ApiObject.ApiObject.create_thread_object_list方法的典型用法代码示例。如果您正苦于以下问题:Python ApiObject.create_thread_object_list方法的具体用法?Python ApiObject.create_thread_object_list怎么用?Python ApiObject.create_thread_object_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myapp.ApiObject.ApiObject
的用法示例。
在下文中一共展示了ApiObject.create_thread_object_list方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_tag_image
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import create_thread_object_list [as 别名]
def get_tag_image(self,tag,page,unit):
query = db.Query(MesThread,keys_only=True)
#query.filter('illust_mode =', BbsConst.ILLUSTMODE_ILLUST)
query.order('-create_date')
query.filter('tag_list =', tag)
cnt=query.count(limit=100)
thread_key_list = query.fetch(limit=unit, offset=(page-1)*unit)
thread_list=ApiObject.create_thread_object_list(self,thread_key_list,"pinterest")
return {"thread_list":thread_list,"cnt":cnt}
示例2: feed_get_thread_list
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import create_thread_object_list [as 别名]
def feed_get_thread_list(req,order,offset,limit):
#最大取得数
if(limit>100):
limit=100
#キャッシュが有効かどうか
cache_enable=ApiFeed._is_cache_enable(offset,limit,order)
#キャッシュ取得
cache_id=ApiFeed._get_cache_id(order,req.request.get("bbs_id"),offset,limit)
if(cache_enable):
data=memcache.get(cache_id)
if(data):
dic=ApiObject.create_thread_object_list(req,data,req.request.get("bbs_id"))
return dic
#スレッド一覧取得
if(order=="hot"):
rank=Ranking.get_by_key_name(BbsConst.THREAD_RANKING_KEY_NAME)
if(rank==None):
rank=Ranking.get_or_insert(BbsConst.THREAD_RANKING_KEY_NAME)
thread_list=rank.get_rank(offset,limit)
bbs_id=None
else:
query=ApiFeed._get_query(order,req.request.get("event_id"))
bbs_id=None
if(req.request.get("bbs_id")):
bbs_key=MappingId.mapping(req.request.get("bbs_id"))
if(bbs_key==""):
return None #bbs not found
query.filter("bbs_key =",db.get(bbs_key))
bbs_id=True
thread_list=query.fetch(offset=offset,limit=limit)
#キャッシュに乗せる
if(cache_enable):
memcache.set(cache_id,thread_list,BbsConst.TOPPAGE_FEED_CACHE_TIME)
#リスト作成
dic=ApiObject.create_thread_object_list(req,thread_list,bbs_id)
return dic
示例3: bookmark_get_thread_list
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import create_thread_object_list [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
示例4: user_get_thread_list_core
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import create_thread_object_list [as 别名]
def user_get_thread_list_core(req,user_id,offset,limit,illust_mode):
#query=db.Query(MesThread) #keys onlyはINが使えない
#query=query.filter("illust_mode IN",[BbsConst.ILLUSTMODE_ILLUST,BbsConst.ILLUSTMODE_MOPER])
#query=query.filter("user_id =",user_id).order("-create_date")
#thread_key_list=[]
#thread_list=query.fetch(limit=limit,offset=offset)
#for thread in thread_list:
# thread_key_list.append(str(thread.key()))
query=db.Query(MesThread,keys_only=True)
query=query.filter("illust_mode =",illust_mode)
query=query.filter("user_id =",user_id).order("-create_date")
thread_key_list=query.fetch(limit=limit,offset=offset)
return ApiObject.create_thread_object_list(req,thread_key_list,"user")
示例5: _text_search
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import create_thread_object_list [as 别名]
def _text_search(self,search,user,user_id,page,request_page_mode,redirect_api,contents_only):
template_values=Pinterest.initialize_template_value(self,user,user_id,page,request_page_mode,redirect_api,contents_only)
search_api="search_tag"
unit=BbsConst.PINTEREST_PAGE_UNIT
thread_list=SearchThread.search(search,page,unit,BbsConst.SEARCH_THREAD_INDEX_NAME)
if(thread_list!=None):
thread_list=ApiObject.create_thread_object_list(self,thread_list,"search")
search_api_error=False
else:
search_api_error=True
if(search=="empty"):
thread_list=None
if(search_api_error):
#例外が起きた場合はTagSearchの結果を使う場合がある
thread_list=Pinterest.get_tag_image(self,search,page,unit)["thread_list"]
if(thread_list):
search_api_error=False
today=datetime.date.today()
ranking_month_list=Pinterest._get_ranking_month_list(today,CssDesign.is_english(self))
template_values['thread_list']=thread_list
template_values['next_query']="search="+urllib.quote_plus(str(search))
template_values['tag_list']=SearchTag.get_recent_tag(search_api)
template_values['page_mode']="search"
template_values['illust_enable']=True
template_values['search']=search
template_values['search_api_error']=search_api_error
template_values['top_page']=True
template_values['ranking_month_list']=ranking_month_list
template_values['month_query']=""
if(search=="empty"):
order="new"
Pinterest._update_event_list(self,template_values,order,contents_only)
Pinterest._update_room_list(self,template_values,order,contents_only)
Pinterest._update_tweet_list(self,template_values,order,contents_only)
template_values["bbs_list"]=ApiFeed.feed_get_bbs_list(self,"hot",0,8)
Pinterest._render_page(self,template_values)
示例6: get_thread
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import create_thread_object_list [as 别名]
def get_thread(self,query,tag,thread_num,page):
query.filter('tag_list =', tag)
thread_key_list = query.fetch(limit=thread_num, offset=(page-1)*thread_num)
thread_list = ApiObject.create_thread_object_list(self,thread_key_list,"search")
return thread_list
示例7: _index
# 需要导入模块: from myapp.ApiObject import ApiObject [as 别名]
# 或者: from myapp.ApiObject.ApiObject import create_thread_object_list [as 别名]
def _index(self,user,user_id,page,request_page_mode,redirect_api,contents_only):
unit=BbsConst.PINTEREST_PAGE_UNIT
order="new"
if(self.request.get("order")):
order=self.request.get("order")
month_query=""
if(self.request.get("query")):
month_query=self.request.get("query")
search_api="search_tag"
ranking_month_list=[]
search_api_error=False
if(order=="monthly"):
if(month_query):
today=datetime.datetime.strptime(month_query,"%Y-%m-%d")
else:
today=datetime.date.today()
ranking_month_list=Pinterest._get_ranking_month_list(today,CssDesign.is_english(self))
thread_list=ApiFeed.feed_get_ranking_thread_list(month_query,page,unit)
if(thread_list!=None):
thread_list=ApiObject.create_thread_object_list(self,thread_list,"search")
search_api_error=False
else:
search_api_error=True
else:
if(order=="lecture"):
search_str="tag = 講座 OR category = 講座"
no_reduct=False #日付における重み付けを外すか
thread_list=SearchThread.search(search_str,page,unit,BbsConst.SEARCH_THREAD_INDEX_NAME,no_reduct)
if(thread_list!=None):
thread_list=ApiObject.create_thread_object_list(self,thread_list,"search")
search_api_error=False
else:
search_api_error=True
else:
if(order=="chat"):
thread_list=None
else:
thread_list=ApiFeed.feed_get_thread_list(self,order,(page-1)*unit,unit)
bbs_list=None
if(order=="hot" and not contents_only):
bbs_list=ApiFeed.feed_get_bbs_list(self,"hot",0,8)
recent_tag=None
if(order=="hot" and not contents_only):
recent_tag=SearchTag.get_recent_tag(search_api)
my_color_bookmark=None
if(user):
my_color_bookmark=ApiObject.get_bookmark_of_user_id(user.user_id())
mute_bbs_list=[]
mute_user_list=[]
if(my_color_bookmark):
mute_bbs_list=my_color_bookmark.get_mute_bbs_list()
mute_user_list=my_color_bookmark.get_mute_user_list()
template_values=Pinterest.initialize_template_value(self,user,user_id,page,request_page_mode,redirect_api,contents_only)
template_values['thread_list']=thread_list
template_values['next_query']="order="+order+"&query="+month_query
template_values['tag_list']=recent_tag
template_values['top_page']=True
template_values['order']=order
template_values['page_mode']="index"
template_values['illust_enable']=True
template_values['bbs_list']=bbs_list
template_values['ranking_month_list']=ranking_month_list
template_values['month_query']=month_query
template_values['search_api_error']=search_api_error
template_values['bookmark']=my_color_bookmark
template_values['mute_bbs_list']=mute_bbs_list
template_values['mute_user_list']=mute_user_list
Pinterest._update_event_list(self,template_values,order,contents_only)
Pinterest._update_room_list(self,template_values,order,contents_only)
Pinterest._update_tweet_list(self,template_values,order,contents_only)
template_values['is_admin']=OwnerCheck.is_admin(user)
Pinterest._render_page(self,template_values)