本文整理汇总了Python中myapp.MappingId.MappingId.get_usr_url方法的典型用法代码示例。如果您正苦于以下问题:Python MappingId.get_usr_url方法的具体用法?Python MappingId.get_usr_url怎么用?Python MappingId.get_usr_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myapp.MappingId.MappingId
的用法示例。
在下文中一共展示了MappingId.get_usr_url方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from myapp.MappingId import MappingId [as 别名]
# 或者: from myapp.MappingId.MappingId import get_usr_url [as 别名]
def get(self):
try:
thread = db.get(self.request.get("thread_key"))
bbs = db.get(self.request.get("bbs_key"))
except:
thread = None
bbs = None
if thread == None or bbs == None:
Alert.alert_msg_with_write(self, "拍手対象のスレッドが見つかりません。")
return
not_spam = (
self.request.remote_addr != thread.applause_ip
and self.request.remote_addr != thread.applause_ip2
and self.request.remote_addr != thread.applause_ip3
and self.request.remote_addr != thread.applause_ip4
)
if not_spam or self.request.get("comment"):
if thread.applause:
thread.applause = thread.applause + 1
else:
thread.applause = 1
thread.applause_ip4 = thread.applause_ip3
thread.applause_ip3 = thread.applause_ip2
thread.applause_ip2 = thread.applause_ip
thread.applause_ip = self.request.remote_addr
thread.applause_date = datetime.datetime.today()
thread.search_index_version = 0
thread.put()
if bbs.applause_n:
bbs.applause_n = bbs.applause_n + 1
else:
bbs.applause_n = 1
bbs.put()
user = users.get_current_user()
comment = ""
if self.request.get("comment"):
comment = self.request.get("comment")
StackFeed.feed_new_applause_thread(user, thread, comment)
Ranking.add_rank_global(thread, BbsConst.SCORE_APPLAUSE)
if self.request.get("mode") == "bbs":
order = self.request.get("order")
page = self.request.get("page")
self.redirect(str(MappingId.get_usr_url("./", bbs) + "?order=" + order + "&page=" + page))
else:
thread_url = self.request.get("thread_key")
if thread.short:
thread_url = thread.short
self.redirect(str(MappingId.get_usr_url("./", bbs) + thread_url + ".html"))
示例2: violate_thread
# 需要导入模块: from myapp.MappingId import MappingId [as 别名]
# 或者: from myapp.MappingId.MappingId import get_usr_url [as 别名]
def violate_thread(self):
# スレッド
thread = db.get(self.request.get("thread_key"))
if self.request.get("mode") == "adult":
if thread.adult:
thread.adult = 0
else:
thread.adult = 1
if self.request.get("mode") == "terms":
if thread.violate_terms:
thread.violate_terms = 0
else:
thread.violate_terms = 1
if self.request.get("mode") == "photo":
if thread.violate_photo:
thread.violate_photo = 0
else:
thread.violate_photo = 1
if self.request.get("mode") == "comment":
if thread.prohibit_comment:
thread.prohibit_comment = 0
else:
thread.prohibit_comment = 1
thread.put()
ApiFeed.invalidate_cache()
bbs = db.get(self.request.get("bbs_key"))
self.redirect(str(MappingId.get_usr_url("./", bbs) + self.request.get("thread_key") + ".html"))
示例3: get_thread_url
# 需要导入模块: from myapp.MappingId import MappingId [as 别名]
# 或者: from myapp.MappingId.MappingId import get_usr_url [as 别名]
def get_thread_url(host,bbs,thread):
url=MappingId.get_usr_url(host,bbs)
if(thread.short):
url+=thread.short
else:
url+=str(thread.key())
url+=".html"
return url
示例4: generate_feed
# 需要导入模块: from myapp.MappingId import MappingId [as 别名]
# 或者: from myapp.MappingId.MappingId import get_usr_url [as 别名]
def generate_feed(bbs, bbs_key):
url = MappingId.get_usr_url("http://www.illustbook.net/", bbs)
feed = feedgenerator.Rss201rev2Feed(
title=bbs.bbs_name, link=url, feed_url=url, description=bbs.summary, language="ja"
)
if bbs.bbs_mode == BbsConst.BBS_MODE_NO_IMAGE:
entry_query = Entry.all().filter("bbs_key =", bbs)
entry_query.order("-date")
all_entry = entry_query.fetch(limit=20)
for entry in all_entry:
try:
thread = entry.thread_key
except:
continue
url2 = url + str(thread.key()) + ".html"
txt = "" + entry.editor + "(" + str(entry.date) + ")<BR>"
if entry.illust_reply:
txt += "<IMG SRC='http://www.illustbook.net/img?img_id='"
txt += str(entry.illust_reply_image_key.key()) + "'><BR>"
txt += entry.content
for res in entry.res_list:
response = db.get(res)
txt += "<BR><BR>" + response.editor + "(" + str(response.date) + ")<BR>"
txt += "" + response.content + "<BR>"
feed.add_item(
title=thread.title,
link=url2,
description=txt,
author_email="",
author_name=entry.editor,
author_link=entry.homepage_addr,
pubdate=entry.date,
)
else:
thread_query = MesThread.all().filter("bbs_key =", bbs)
thread_query.order("-create_date")
all_threads = thread_query.fetch(limit=20)
for thread in all_threads:
url2 = url + str(thread.key()) + ".html"
if thread.image_key:
thumbnail = "http://www.illustbook.net/img?img_id=" + str(thread.image_key.key())
feed.add_item(
title=thread.title,
link=url2,
description="<IMG SRC=" + thumbnail + "><BR>" + thread.summary,
author_email="",
author_name=thread.author,
author_link=thread.homepage_addr,
pubdate=thread.create_date,
)
result = feed.writeString("utf-8")
return result
示例5: get
# 需要导入模块: from myapp.MappingId import MappingId [as 别名]
# 或者: from myapp.MappingId.MappingId import get_usr_url [as 别名]
def get(self):
try:
bbs=db.get(self.request.get("bbs_key"))
except:
bbs=None
if(bbs==None):
Alert.alert_msg_notfound(self)
return
host_url=MappingId.mapping_host_with_scheme(self.request)+"/";
url=MappingId.get_usr_url(host_url,bbs)
self.redirect(str(url))
示例6: violate_entry
# 需要导入模块: from myapp.MappingId import MappingId [as 别名]
# 或者: from myapp.MappingId.MappingId import get_usr_url [as 别名]
def violate_entry(self):
# エントリー
entry = db.get(self.request.get("entry_key"))
if entry.violate_terms:
entry.violate_terms = 0
else:
entry.violate_terms = 1
entry.put()
bbs = db.get(self.request.get("bbs_key"))
self.redirect(str(MappingId.get_usr_url("./", bbs) + self.request.get("thread_key") + ".html"))
示例7: get
# 需要导入模块: from myapp.MappingId import MappingId [as 别名]
# 或者: from myapp.MappingId.MappingId import get_usr_url [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)
#掲示板のデザインを取得
#.........这里部分代码省略.........