本文整理汇总了Python中myapp.MappingId.MappingId.mapping方法的典型用法代码示例。如果您正苦于以下问题:Python MappingId.mapping方法的具体用法?Python MappingId.mapping怎么用?Python MappingId.mapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myapp.MappingId.MappingId
的用法示例。
在下文中一共展示了MappingId.mapping方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_thread_list
# 需要导入模块: from myapp.MappingId import MappingId [as 别名]
# 或者: from myapp.MappingId.MappingId import mapping [as 别名]
def get_thread_list(self,analytics):
start_date=str(datetime.date.today()+datetime.timedelta(days=-1))
end_date=str(datetime.date.today())
result=analytics.get("page",".*",start_date,end_date)
thread_list=[]
for one in result:
url=one["ga:pagePath"]
count=int(one["ga:pageviews"])
data=url.split("/")
try:
bbs_name=str(data[1])
thread_name=str(data[2].split(".")[0])
except:
continue
bbs_key=MappingId.mapping(bbs_name)
bbs=ApiObject.get_cached_object(bbs_key)
if(not bbs):
continue
thread = MappingThreadId.mapping(bbs,thread_name)
if(not thread):
continue
while(count>=1):
thread_list.append(thread.key())
count=count-1
return thread_list
示例2: get
# 需要导入模块: from myapp.MappingId import MappingId [as 别名]
# 或者: from myapp.MappingId.MappingId import mapping [as 别名]
def get(self, bbs_key):
SetUtf8.set()
bbs_key_original = bbs_key
# キャッシュに存在するか判定
result = memcache.get("feed_" + bbs_key_original)
# result=None
if not result:
# キャッシュに存在しない場合はRSS作成
# 掲示板取得
bbs_key = MappingId.mapping(bbs_key)
bbs = None
try:
bbs = db.get(bbs_key)
except:
bbs = None
if bbs == None:
self.error(404)
return
# feedを作成
result = RssFeed.generate_feed(bbs, bbs_key)
# キャッシュに入れる
memcache.set("feed_" + bbs_key_original, result, 60 * 60 * 3) # 3時間
self.response.headers["Content-Type"] = "text/xml; charset=utf-8"
self.response.out.write(result)
示例3: add_support_forum
# 需要导入模块: from myapp.MappingId import MappingId [as 别名]
# 或者: from myapp.MappingId.MappingId import mapping [as 别名]
def add_support_forum(main,app):
if(not app.support_forum and app.is_public):
thread=MesThread()
bbs_key=MappingId.mapping(BbsConst.APP_SUPPORT_BBS_ID)
if(bbs_key==""):
#return False
main.response.out.write(Alert.alert_msg("サポートフォーラムBBS[ID:"+BbsConst.APP_SUPPORT_BBS_ID+"]が見つかりません。",main.request.host))
return True
bbs=db.get(bbs_key)
thread.bbs_key=bbs
thread.title=app.app_name
thread.author=app.author
thread.summary=app.app_name+"のサポートフォーラムです。"
thread.user_id=app.user_id
thread.illust_mode=BbsConst.ILLUSTMODE_NONE
thread.create_date=datetime.datetime.today()
thread.comment_cnt=0
thread.date=datetime.datetime.today()
thread.put()
app.support_forum=thread
app.put()
#if(not app.support_forum.score):
# app.support_forum.score = None
# app.support_forum.put()
return False
示例4: get
# 需要导入模块: from myapp.MappingId import MappingId [as 别名]
# 或者: from myapp.MappingId.MappingId import mapping [as 别名]
def get(self):
user = users.get_current_user()
user_name=ShowEntry.get_user_name(user)
bbs_list=[]
if(user):
user_id=user.user_id()
bookmark_bbs_list=ApiBookmark.bookmark_get_bbs_list(self,user_id)
rental_bbs_list=ApiUser.user_get_bbs_list(self,user_id)
if(rental_bbs_list):
bbs_list.extend(rental_bbs_list)
if(bookmark_bbs_list):
bbs_list.extend(bookmark_bbs_list)
sample_bbs={
"title":"サンプルお絵描き掲示板",
"key":MappingId.mapping("sample")
}
bbs_list.append(sample_bbs)
temp_key=self.request.get("temp_key")
args=None
if(temp_key):
temp=db.get(temp_key)
if(temp.args):
args=temp.args
target_bbs=self.get_target_bbs(args);
if(target_bbs):
bbs_list=target_bbs
template_values={
'host':"./",
'is_iphone':CssDesign.is_iphone(self),
'is_tablet':CssDesign.is_tablet(self),
'is_english':CssDesign.is_english(self),
'temp_key':temp_key,
'redirect_url':self.request.path+"?temp_key="+temp_key,
'user':user,
'bbs_list':bbs_list,
'args':args,
'user_name':user_name
}
render=template_select.render("/html/upload_temp.html", template_values)
self.response.out.write(render)
示例5: feed_get_thread_list
# 需要导入模块: from myapp.MappingId import MappingId [as 别名]
# 或者: from myapp.MappingId.MappingId import mapping [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
示例6: get
# 需要导入模块: from myapp.MappingId import MappingId [as 别名]
# 或者: from myapp.MappingId.MappingId import mapping [as 别名]
def get(self,bbs_key,thread_key):
SetUtf8.set()
#ホストチェック
if SpamCheck.is_deny(self.request):
self.response.set_status(401)
return
#英語版かどうか
is_english=CssDesign.is_english(self)
#BBSを取得
bbs_key=MappingId.mapping(bbs_key)
bbs=ApiObject.get_cached_object(bbs_key)
if(bbs == None):
Alert.alert_msg_notfound(self)
return
#BBSが削除されていた場合
if(bbs.del_flag) :
if(is_english):
Alert.alert_msg_with_write(self,"This bbs was deleted.")
else:
Alert.alert_msg_with_write(self,"このBBSは削除されました。")
return
#ページ番号を取得
col_num = 10
page = 1
if self.request.get("page"):
page = int(self.request.get("page"))
if page < 1:
page=1
#メンテナンス画面
is_maintenance=0
if(MaintenanceCheck.is_appengine_maintenance()):
is_maintenance=1
#オーダー取得
order="update"
if(bbs.default_comment_order==1):
order="new"
if self.request.get("order"):
order=self.request.get("order")
#スレッド取得
thread=ShowThread.get_thread(bbs,thread_key)
if(thread == None):
Alert.alert_msg_notfound(self)
return
#コメント数を更新
if(bbs.page_comment_n):
col_num=bbs.page_comment_n
if(self.request.get("limit")):
col_num=int(self.request.get("limit"))
#コメントの一覧を取得
query=ShowThread.get_comment_query(thread,order)
entry_num = query.count()
if(entry_num==0):
com_list_ = []
else:
com_list_ = query.fetch(limit=col_num, offset=(page-1)*col_num)
#検索
search=""
if(self.request.get("search")):
search=self.request.get("search")
query=""+search+' thread_key:"'+str(thread.key())+'"'
com_list_=SearchThread.search(query,page,col_num,BbsConst.SEARCH_ENTRY_INDEX_NAME)
#実体への変換
com_list_=ApiObject.get_cached_object_list(com_list_)
#現在のスレッドへのURLを取得
host_url=MappingId.mapping_host_with_scheme(self.request)+"/"
#編集モードか
user = users.get_current_user()
edit_flag = 0
if(not OwnerCheck.check(bbs,user)):
edit_flag = 1
logined=0
if(user):
logined=1
owner=user
if(OwnerCheck.check(bbs,user)):
owner=None
admin_user=OwnerCheck.is_admin(user)
#ページリンクを作成
page_url_base = MappingId.get_usr_url(host_url,bbs)+thread_key+'.html?page='
page_list=ShowThread.create_page_list(page,entry_num,col_num)
#掲示板のデザインを取得
#.........这里部分代码省略.........