def get(self): #日本語対応 SetUtf8.set() if(ApiObject.check_api_capacity(self)): return dic=ApiBookmark.get_core(self) ApiObject.write_json_core(self,dic)
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)
def get(self): SetUtf8.set() #ユーザ取得 user=users.get_current_user() #モード取得 mode=self.request.get("mode") if(mode=="create"): self.create_room(user) return if(mode=="get_command"): self.get_command() return if(mode=="delete"): self.close_room(user) return if(mode=="tool"): self.redirect(str("http://"+self.request.host+"/?order=chat&room_key="+self.request.get("key"))) #self.show_portal(user) #login require #self.tool(user) return if(mode=="thumbnail"): self.thumbnail() return if(mode=="snap_shot"): self.get_snap_shot() return if(mode=="user_list"): self.get_user_list() return #ポータル self.show_portal(user)
def get(self): SetUtf8.set() data="" user = users.get_current_user() user_id=""; if(user): user_id=user.user_id() is_iphone=CssDesign.is_iphone(self) is_mobile=is_iphone or CssDesign.is_tablet(self) app_key=ApiPerpetuation.get_app_key(self) host_url="http://"+MappingId.mapping_host(self.request.host)+"/"; template_values = { 'host': host_url, 'user_id': user_id, 'is_mobile': is_mobile, 'is_iphone': is_iphone, 'app_key': app_key } self.response.content_type = 'text/javascript' path = "/html/api/illustbook.js" self.response.out.write(template_select.render(path, template_values))
def post(self): SetUtf8.set() page=None if(self.request.get("page")): page=self.request.get("page") user = users.get_current_user() if(not user): if(page=="update"): dic={"status":"failed","message":"アプリを登録するにはログインする必要があります。"} ApiObject.write_json_core(self,dic) return else: self.response.out.write(Alert.alert_msg("アプリを登録するにはログインする必要があります。",self.request.host)) return if(page=="update"): dic=DevPortal.update_app(self,user) if(dic==None): return ApiObject.write_json_core(self,dic) return if(page=="submit"): if(not DevPortal.add_new_app(self,user)): return DevPortal.ret(self,"top")
def get(self): #移動 if(self.request.host=="illust-book.appspot.com"): self.redirect(str("http://www.illustbook.net/")) return SetUtf8.set() #ホストチェック if SpamCheck.is_deny(self.request): self.response.set_status(401) return #メンテナンス画面 is_maintenance=0 if(MaintenanceCheck.is_appengine_maintenance()): is_maintenance=1 #BBS COUNT cache=SiteAnalyzer.get_cache() bbs_n=cache["bbs_n"] illust_n=cache["illust_n"] #最近のタグ tag_list=SearchTag.get_recent_tag("search_tag") #デベロッパーオプション user = users.get_current_user() is_dev_enable=OwnerCheck.is_admin(user) #iPhoneモードかどうか is_iphone=CssDesign.is_iphone(self) #リダイレクト if(BbsConst.PINTEREST_MODE): if((user and OwnerCheck.is_admin(user)) or BbsConst.PINTEREST_MODE==2): return Pinterest.get_core(self,Pinterest.PAGE_MODE_NORMAL) #URL生成 template_values = { 'host': "./", 'mes_bord_url': 'mes_bord', 'new_url': 'create_new_thread', 'bbs_n':bbs_n, 'illust_n':illust_n, 'tag_list':tag_list, 'is_dev_enable':is_dev_enable, 'is_maintenance': is_maintenance, 'is_iphone': is_iphone, 'user': user, 'redirect_url': self.request.path, 'top_page': True, 'mode': "index" } path = '/html/index.html' self.response.out.write(template_select.render(path, template_values))
def get_core(self,request_page_mode): SetUtf8.set() unit=BbsConst.PINTEREST_PAGE_UNIT user = users.get_current_user() search=None if(self.request.get("search")): search=self.request.get("search") page=1 if(self.request.get("page")): page=int(self.request.get("page")) tag="" if(self.request.get("tag")): tag=self.request.get("tag") user_id="" if(self.request.get("user_id")): user_id=self.request.get("user_id") if user_id=="" and (request_page_mode==Pinterest.PAGE_MODE_MYPAGE or request_page_mode==Pinterest.PAGE_MODE_REGIST) and user: user_id=user.user_id() #リダイレクト先API redirect_api="./" if(request_page_mode==Pinterest.PAGE_MODE_MYPAGE or request_page_mode==Pinterest.PAGE_MODE_REGIST): redirect_api="mypage" #コンテンツのみを供給するか contents_only=None if(self.request.get("contents_only")): contents_only=True if(user_id!=""): Pinterest._user_page(self,user,user_id,page,request_page_mode,redirect_api,contents_only) return if(request_page_mode==Pinterest.PAGE_MODE_BOOKMARK): Pinterest._bookmark(self,user,user_id,page,request_page_mode,redirect_api,contents_only) return if(request_page_mode==Pinterest.PAGE_MODE_GUIDE): Pinterest._guide(self,user,user_id,page,request_page_mode,redirect_api,contents_only) return if(tag!=""): Pinterest._tag_search(self,tag,user,user_id,page,request_page_mode,redirect_api,contents_only) return if(search): Pinterest._text_search(self,search,user,user_id,page,request_page_mode,redirect_api,contents_only) return if(request_page_mode==Pinterest.PAGE_MODE_MYPAGE and user_id==""): Pinterest._login_require(self,user,user_id,page,request_page_mode,redirect_api,contents_only) return Pinterest._index(self,user,user_id,page,request_page_mode,redirect_api,contents_only) return
def post(self): mode=self.request.get("mode") if(mode=="post_command"): self.post_command() return if(mode=="post_snapshot"): self.post_snapshot() return if(mode=="tool"): SetUtf8.set() user=users.get_current_user() self.tool(user) return
def get(self): SetUtf8.set() user = users.get_current_user() if(not user): self.response.out.write(Alert.alert_msg("ログインしている必要があります。",self.request.host)); return; thread=None try: thread = db.get(self.request.get("thread_key")) except: thread=None if(not thread): self.response.out.write(Alert.alert_msg("スレッドが見つかりません。",self.request.host)); return mode = self.request.get("mode") if(not thread.tag_list): thread.tag_list=[] tag=self.request.get("tag") if(tag==""): self.response.out.write(Alert.alert_msg("タグを入力して下さい。",self.request.host)); return; if(mode=="add"): if(thread.tag_list.count(tag)>0): thread.tag_list.remove(tag) thread.tag_list.insert(0,tag) else: thread.tag_list.insert(0,tag) tag_info="[Add Tag] "+tag+" "+str(user.user_id())+" "+user.email() thread.tag_last_edit=tag thread.tag_last_edit_user_id=str(user.user_id()) logging.info(tag_info) else: try: thread.tag_list.remove(tag) except: self.response.out.write(Alert.alert_msg("タグ"+tag+"が見つかりません。",self.request.host)); thread.put() bbs=db.get(self.request.get("bbs_key")) thread=db.get(self.request.get("thread_key")) url=MappingThreadId.get_thread_url("./",bbs,thread) self.redirect(str(url))
def render(template_path, template_dict, debug=False): SetUtf8.set() path_list = template_path.split("/") new_path = "" for i in range(2, len(path_list)): new_path += "/" + path_list[i] if path_list[1] == "tempform": jinja_template = jinja_environment_temp.get_template(new_path) else: jinja_template = jinja_environment_html.get_template(new_path) render_value = jinja_template.render(template_dict) # return render_value return short(render_value)
def get(self): SetUtf8.set() user = users.get_current_user() is_admin=0 if(user): if(OwnerCheck.is_admin(user)): is_admin=1 if(not is_admin): Alert.alert_msg_with_write(self,"管理者権限が必要です。"); return message="" new_code=self.request.get('code') if(new_code): if(len(new_code)>=8): memcache.set("spamcheck",new_code) message="updated check code to "+new_code else: message="too short check code" checkcode=SpamCheck.get_check_code() query=Entry.all() thread=None try: thread=db.get(checkcode) except: thread=None if(thread): query.filter("thread_key =",thread) entrys=query.fetch(limit=1000) ret="" spam_detected=0 for entry in entrys: if(SpamCheck.check_with_thread(entry,checkcode)): ret+=entry.content+"<BR>" spam_detected=1 if(not spam_detected): ret="SpamNotFound" form="code:"+checkcode+"<BR>"+message+"<BR>" form+="<form method='GET' action='spam_check'>thread_key:<input type='text' name='code' size=40><input type='submit' value='UPDATE'></form>"; Alert.alert_msg_with_write(self,"<H2>SPAM CHECKER</H2><H3>CHECK CODE</H3>"+form+"<H3>SPAM LIST</H3>"+ret+"<BR><BR><A HREF='./spam_delete'>DELETE ALL</A>")
def get(self): SetUtf8.set() page="top" if(self.request.get("page")): page=self.request.get("page") if(page=="delete"): if(DevPortal.delete_app(self)): return page="top" if(page=="del_image"): DevPortal.delete_image(self) return DevPortal.ret(self,page)
def get(self): SetUtf8.set() #Query文字列を取得 query=self.request.query_string; #RESULT result_dic={} request_no=0 #APIリクエストに分解 api_list=query.split(":") for api in api_list: #APIの引数を取得 args=api.split("&") #引数をDictionaryに分解 api_args={} for arg in args: params=arg.split("=") if(len(params)>=2): api_args[params[0]]=params[1] #呼び出しAPIのクラス名を決定 if(api_args.has_key("class")): #ダミーリクエストハンドラーを作成 req=HttpHandlerHook() req.request.args=api_args req.request.host=self.request.host #API呼び出し dic=None if(api_args["class"]=="api_bookmark"): dic=ApiBookmark.get_core(req) if(api_args["class"]=="api_user"): dic=ApiUser.get_core(req) if(api_args["class"]=="api_feed"): dic=ApiFeed.get_core(req) if(dic==None): logging.error("UnknownClass:"+api_args["class"]) else: result_dic["request"+str(request_no)]=dic request_no=request_no+1 ApiObject.write_json_core(self,result_dic)
def get(self): SetUtf8.set() user = users.get_current_user() if user: if not OwnerCheck.is_admin(user): Alert.alert_msg_with_write(self, "権限がありません。") return if self.request.get("user_id"): self.violate_icon() return if self.request.get("entry_key"): self.violate_entry() return self.violate_thread()
def post(self): # 日本語対応 SetUtf8.set() if ApiObject.check_api_capacity(self): return # パラメータ取得 method = "" if self.request.get("method"): method = self.request.get("method") # 返り値 dic = {"status": "failed", "message": "methodが見つかりません"} # ユーザクラス if method == "putData": dic = ApiPerpetuation.put_data(self) ApiObject.write_json_core(self, dic)
def get(self): SetUtf8.set() #ランキング更新 rank=Ranking.get_or_insert(BbsConst.THREAD_RANKING_KEY_NAME) rank.create_rank(self) ApiFeed.invalidate_cache(); #キャッシュ取得 cache=SiteAnalyzer.get_cache_from_db(); #1日単位で習得 #force=False #if(self.request.get("force")): # force=True if(cache.date and len(cache.day_list)>=1):# and not force): day1_str=NicoTracker.get_day_string(cache.date) day2_str=NicoTracker.get_day_string(datetime.datetime.today()) if(day1_str==day2_str): Alert.alert_msg_with_write(self,"ランキングを更新しました。統計情報はまだ1日が経過していないので計測していません。") return #コメント数と再生数を取得 bbs_cnt=Bbs.all().count(limit=100000) illust_cnt=MesThread.all().count(limit=100000) entry_cnt=Entry.all().count(limit=100000) user_cnt=Bookmark.all().count(limit=100000) #書き込み day_str=NicoTracker.get_day_string(datetime.datetime.today()) cache.entry_cnt_list.insert(0,entry_cnt) cache.illust_cnt_list.insert(0,illust_cnt) cache.bbs_cnt_list.insert(0,bbs_cnt) cache.user_cnt_list.insert(0,user_cnt) cache.day_list.insert(0,day_str) cache.bbs_n=bbs_cnt cache.illust_n=illust_cnt cache.put() Alert.alert_msg_with_write(self,"ランキングを更新しました。")
def get(self): SetUtf8.set() user = users.get_current_user() is_admin=0 if(user): if(OwnerCheck.is_admin(user)): is_admin=1 if(not is_admin): self.response.out.write(Alert.alert_msg("管理者権限が必要です。",self.request.host)); return checkcode=SpamCheck.get_check_code() query=Entry.all() thread=None try: thread=db.get(checkcode) except: thread=None if(thread): query.filter("thread_key =",thread) entrys=query.fetch(limit=1000) ret=0 aborted="" for entry in entrys: if(SpamCheck.check_with_thread(entry,checkcode)): entry.delete() ret=ret+1 if(ret>=250): aborted="ABORTED" break; RecentCommentCache.invalidate(None); self.response.out.write(Alert.alert_msg("<H2>SPAM DELETE RESULT</H2>"+aborted+"<H2>TOTAL</H2>DELETE CNT:"+str(ret),self.request.host))
def post(self): SetUtf8.set() try: bbs = db.get(self.request.get("bbs_key")) except: Alert.alert_msg_with_write(self,"掲示板の取得に失敗しました。") return user = users.get_current_user() if(OwnerCheck.check(bbs,user) and not OwnerCheck.is_admin(user)): Alert.alert_msg_with_write(self,"削除する権限がありません。") return category_count=self.update_category() link_count=self.update_link(user) deleted_count=self.delete_thread(bbs) page=self.request.get("page") order=self.request.get("order") url="./edit_thread_list?bbs_key="+str(bbs.key())+"&page="+str(page)+"&order="+order+"&deleted_count="+str(deleted_count)+"&category_count="+str(category_count)+"&link_count="+str(link_count) self.redirect(str(url))
def get(self): SetUtf8.set() is_english=CssDesign.is_english(self) short=self.request.get('id') if(MappingId.key_format_check(short)): txt="IDは半角英数である必要があります。" if(is_english): txt="ID must be 16 characters or less" Alert.alert_msg_with_write(self,txt) return if(MappingId.check_capability(short,"")==0): txt="ID:"+short+"は既に登録されていて利用できません。" if(is_english): txt="ID:"+short+" is not available" Alert.alert_msg_with_write(self,txt) return txt="ID:"+short+"は利用可能です。" if(is_english): txt="ID:"+short+" is available" Alert.alert_msg_with_write(self,txt)
def get(self): SetUtf8.set() mode=None if(self.request.get("mode")): mode=self.request.get("mode") app_key=None if(self.request.get("app_key")): app_key=self.request.get("app_key") if(self.request.get("app_id")): app_key=AppPortal.get_app_key(self.request.get("app_id")) if(mode=="icon"): app = db.get(app_key) if(app.icon): self.response.headers['Content-Type'] = str(app.icon_content_type) self.response.out.write(app.icon) else: self.redirect(str("./static_files/app/app_icon.png")) return AppPortal.ret(self,mode,app_key)
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) #掲示板のデザインを取得 design=CssDesign.get_design_object(self,bbs,host_url,1) #コメントフォームを取得する show_comment_form=1 if(bbs.comment_login_require and not(owner)): show_comment_form=0 #名前取得 user_name=ShowEntry.get_user_name(user) #自分のイラストか my_illust=False if(user and thread.user_id==user.user_id()): my_illust=True #IPを表示するかどうか show_ip=False if(self.request.get("show_ip") and (owner or admin_user)): show_ip=True #コメントのレンダリング comment=ShowEntry.render_comment(self,host_url,bbs,thread,com_list_,edit_flag,bbs_key,logined,show_comment_form,admin_user,user_name,user,show_ip) #凍結されているか frozen=ApiObject.is_frozen_thread(thread) #拍手が有効かどうか applause_enable=not (user and thread.user_id and thread.user_id==user.user_id()) #メッセージ message=memcache.get(BbsConst.OBJECT_THREAD_MESSAGE_HEADER+str(thread.key())) #関連イラスト related=self._get_related(bbs,thread,design["is_iphone"],design["is_tablet"]) #スパム対策 force_login_to_create_new_image=BbsConst.FORCE_LOGIN_TO_CREATE_NEW_IMAGE force_login_to_create_new_comment=BbsConst.FORCE_LOGIN_TO_CREATE_NEW_COMMENT #描画 template_values = { 'host': host_url, 'usrhost': MappingId.get_usr_url(host_url,bbs), 'bbs': bbs, 'bbs_str_key': str(bbs.key()), 'thread': thread, 'edit_flag':edit_flag, 'url': 'edit', 'url_linktext': 'edit blogs', 'bbs_key': bbs_key, 'page':page, 'page_url_base':page_url_base, 'page_list':page_list, 'logined':logined, 'user':user, 'owner':owner, 'my_illust':my_illust, 'template_path':design["template_path"], 'css_name':design["css_name"], 'is_iphone':design["is_iphone"], 'is_tablet':design["is_tablet"], 'template_base_color':design["template_base_color"], 'admin_user':admin_user, 'order':order, 'is_maintenance':is_maintenance, 'redirect_url': self.request.path, 'comment':comment, 'show_comment_form':show_comment_form, 'user_name':user_name, 'search': search, 'limit': col_num, 'frozen': frozen, 'applause_enable': applause_enable, 'message': message, 'is_english': is_english, 'related': related, 'show_ip': show_ip, 'force_login_to_create_new_image': force_login_to_create_new_image, 'force_login_to_create_new_comment': force_login_to_create_new_comment } path = "/html/"+design["base_name"] self.response.out.write(template_select.render(path, template_values)) CounterWorker.update_counter(self,bbs,thread,owner)
def get(self): SetUtf8.set() mode = self.request.get("mode") #スレッド取得 thread = AddBookmark.get_one_db(self.request.get("thread_key")) if(not thread and mode=="add"): #削除はスレッドが見つからなくてもできるようにする Alert.alert_msg_with_write(self,"スレッドが見つかりません。"); return #BBS取得 bbs=AddBookmark.get_one_db(self.request.get("bbs_key")) if(not bbs and mode=="add_bbs"): Alert.alert_msg_with_write(self,"掲示板が見つかりません。"); return #アプリ取得 app=AddBookmark.get_one_db(self.request.get("app_key")) if(not app and mode=="add_app"): Alert.alert_msg_with_write(self,"アプリが見つかりません。"); return #ログイン要求 user = users.get_current_user() if(not(user)): Alert.alert_msg_with_write(self,"ブックマークをする場合はログインが必須です。"); return bookmark=ApiObject.get_bookmark_of_user_id_for_write(user.user_id()) if(bookmark==None): Alert.alert_msg_with_write(self,"ブックマークの取得に失敗しました。"); return #ユーザ add_user_key=self.request.get("user_key") #ブックマーク数を初期化 if(thread): if(not thread.bookmark_count): thread.bookmark_count=0 if(bbs): if(not bbs.bookmark_count): bbs.bookmark_count=0 add_thread_key=None if(self.request.get("thread_key")): add_thread_key=db.Key(self.request.get("thread_key")) add_bbs_key=None if(self.request.get("bbs_key")): add_bbs_key=db.Key(self.request.get("bbs_key")) add_app_key=None if(self.request.get("app_key")): add_app_key=db.Key(self.request.get("app_key")) comment=None if(self.request.get("comment")): comment=self.request.get("comment") #unpack mute_bbs_list mute_bbs_list=bookmark.get_mute_bbs_list() mute_user_list=bookmark.get_mute_user_list() #add bookmark feed_enable=False if(mode=="add"): AddBookmark.add_comment(thread,user.user_id(),comment) feed_enable=AddBookmark.add_one(bookmark.thread_key_list,add_thread_key,thread,True) if(mode=="add_bbs"): feed_enable=AddBookmark.add_one(bookmark.bbs_key_list,add_bbs_key,bbs,True) if(mode=="add_mute_bbs"): feed_enable=AddBookmark.add_one(mute_bbs_list,str(add_bbs_key),bbs,False) if(mode=="add_app"): AddBookmark.add_one(bookmark.app_key_list,add_app_key,app,True) if(mode=="add_user"): feed_enable=AddBookmark.add_user(bookmark.user_list,add_user_key) if(mode=="add_mute_user"): feed_enable=AddBookmark.add_user(mute_user_list,add_user_key) #del bookmark if(mode=="del"): AddBookmark.del_one(bookmark.thread_key_list,add_thread_key,thread,True) if(mode=="del_bbs"): AddBookmark.del_one(bookmark.bbs_key_list,add_bbs_key,bbs,True) if(mode=="del_mute_bbs"): AddBookmark.del_one(mute_bbs_list,str(add_bbs_key),bbs,False) if(mode=="del_app"): AddBookmark.del_one(bookmark.app_key_list,add_app_key,app,True) if(mode=="del_user"): if(add_user_key in bookmark.user_list): bookmark.user_list.remove(add_user_key) if(mode=="del_mute_user"): if(add_user_key in mute_user_list): mute_user_list.remove(add_user_key) #pack mute_bbs_list bookmark.mute_bbs_packed_str_list="" for one_bbs in mute_bbs_list: bookmark.mute_bbs_packed_str_list+=str(one_bbs)+"#" bookmark.mute_user_packed_str_list="" for m_user in mute_user_list: bookmark.mute_user_packed_str_list+=str(m_user)+"#" #フォロー先のユーザのフォロワーを更新するようにリクエスト if(mode=="add_user" or mode=="del_user"): ApiObject.invalidate_follower_list(add_user_key) #write bookmark.put() #feed(feed内でもbookmark.putを行うため、bookmark.putの前に置いてはいけない) if(mode=="add"): if(feed_enable): StackFeed.feed_new_bookmark_thread(user,thread,comment) Ranking.add_rank_global(thread,BbsConst.SCORE_BOOKMARK) if(mode=="add_bbs"): if(feed_enable): StackFeed.feed_new_bookmark_bbs(user,bbs) if(mode=="add_user"): if(feed_enable): StackFeed.feed_new_follow(user,add_user_key) if(mode=="del_user"): StackFeed.feed_unfollow(user,add_user_key) #redirect url="./mypage" if(mode=="del" or mode=="add"): url=url+"?tab=bookmark" if(mode=="del_bbs" or mode=="add_bbs"): url=url+"?tab=bbs" if(mode=="del_mute_bbs" or mode=="add_mute_bbs"): url=url+"?tab=bbs" if(mode=="add_user" or mode=="del_user"): url=url+"?user_id="+add_user_key if(mode=="add" or mode=="add_bbs"): Alert.alert_msg_with_write(self,"success"); else: self.redirect(str(url))
def get(self): SetUtf8.set() try: bbs = db.get(self.request.get("bbs_key")) except: Alert.alert_msg_with_write(self,"掲示板の取得に失敗しました。") return user = users.get_current_user() if(OwnerCheck.check(bbs,user) and not OwnerCheck.is_admin(user)): Alert.alert_msg_with_write(self,"削除する権限がありません。") return user = users.get_current_user() page=1 if(self.request.get("page")): page=int(self.request.get("page")) order="new" if(self.request.get("order")): order=self.request.get("order") limit=20 offset=(page-1)*limit query=db.Query(MesThread,keys_only=True) query.filter("bbs_key =",bbs) if(order=="new"): query.order("-create_date") else: query.order("create_date") thread_key_list=query.fetch(offset=offset,limit=limit) thread_list=[] for thread_key in thread_key_list: try: thread_list.append(db.get(thread_key)) except: continue deleted_count=self.request.get("deleted_count") category_count=self.request.get("category_count") link_count=self.request.get("link_count") if(deleted_count): deleted_count=int(deleted_count) if(category_count): category_count=int(category_count) if(link_count): link_count=int(link_count) category_list=CategoryList.get_category_list(bbs) template_values = { 'host': './', 'bbs': bbs, 'user': user, 'thread_list': thread_list, 'redirect_url': self.request.path, 'page': page, 'order': order, 'deleted_count': deleted_count, 'category_count': category_count, 'link_count': link_count, 'is_iphone': CssDesign.is_iphone(self), 'is_tablet': CssDesign.is_tablet(self), 'category_list': category_list, 'is_english': CssDesign.is_english(self) } path = '/html/edit_thread_list.html' self.response.out.write(template_select.render(path, template_values))
def post(self): SetUtf8.set() is_english=CssDesign.is_english(self) #エラーコードはFlash向けかどうか is_flash=False if(self.request.get('image')): is_flash=True #書き込み対象のコメントを取得 if(self.request.get("entry_key")): #上書きモード entry = db.get(self.request.get("entry_key")) overwrite = True else: entry = Entry() overwrite = False #コメント if(self.request.get('comment')): entry.content = self.request.get('comment') else: if(self.request.get('image')): entry.content = "" else: if(is_english): self.write_status(is_flash,"Please input comment"); else: self.write_status(is_flash,"コメントを入力して下さい。"); return #名前 if(self.request.get('author')): entry.editor = cgi.escape(self.request.get('author')) else: entry.editor = "no_name" if(is_english): self.write_status(is_flash,"Please input name"); else: self.write_status(is_flash,"名前を入力して下さい。"); return if(not self.request.get('image')): if(self.request.get("seed")!=BbsConst.SUBMIT_SEED): self.write_status(is_flash,"シードが一致しません。"); return if(self.request.get('mail_addr')): entry.mail=self.request.get('mail_addr') else: entry.mail="" if(self.request.get('homepage_addr') and self.request.get('homepage_addr')!="http://"): entry.homepage_addr=self.request.get('homepage_addr') else: entry.homepage_addr="" user = users.get_current_user() thread=db.Key(self.request.get("thread_key")) bbs = db.get(self.request.get("bbs_key")) if(SpamCheck.check_all(self,entry.content,self.request.get("remote_host"),user,bbs,is_flash,is_english)): return #二重投稿ブロック if(entry.content!="" and memcache.get("add_entry_double_block")==entry.content): if(is_flash): self.write_status(is_flash,"二重投稿を検出しました。時間を置いて、再度、投稿して下さい。"); else: url=MappingThreadId.get_thread_url("./",bbs,db.get(self.request.get("thread_key"))) self.redirect(str(url)) return #コメント禁止 if(db.get(thread).prohibit_comment): self.write_status(is_flash,"このイラストへのコメントは禁止されています。"); return #書き込み権限確認 if(bbs.comment_login_require): if(not(user)): self.write_status(is_flash,"この掲示板ではコメントする際にログインが必須です。"); return #上書き権限確認 if(overwrite): bbs=db.get(self.request.get("bbs_key")) if(OwnerCheck.check(bbs,user)): if(user and entry.user_id!=user.user_id()): self.write_status(is_flash,"上書き投稿する権限がありません。"); return #イラストの設定 delete_thread_image=None if(self.request.get('image')): if(overwrite): delete_thread_image=entry.illust_reply_image_key timage=ThreadImage() timage.bbs_key=bbs if(self.request.get("base64") and self.request.get("base64")=="1"): timage.image=db.Blob(base64.b64decode(self.request.get("image"))) timage.thumbnail=db.Blob(base64.b64decode(self.request.get("thumbnail"))) else: timage.image=db.Blob(self.request.get("image")) timage.thumbnail=db.Blob(self.request.get("thumbnail")) timage.thumbnail2=None timage.illust_mode=1; try: timage.put() except: if(is_english): self.write_status(is_flash,"Too big image"); else: self.write_status(is_flash,"画像サイズが大きすぎます。"); return entry.illust_reply=1 entry.illust_reply_image_key=timage else: entry.content=cgi.escape(entry.content) entry.content=EscapeComment.auto_link(entry.content) entry.content=EscapeComment.escape_br(entry.content) entry.thread_key = thread entry.bbs_key = bbs entry.del_flag = 1 if(self.request.get("regulation")): entry.adult=int(self.request.get("regulation")) #プロフィールにリンクするか link_to_profile=StackFeed.is_link_to_profile(self) if(link_to_profile and user): entry.user_id=user.user_id() #スレッドを取得 thread = db.get(self.request.get("thread_key")) #基本情報を設定 if(not overwrite): self.set_basic_info(entry,thread) #保存 if(not SyncPut.put_sync(entry)): message="コメントの投稿は成功しましたが表示が遅延しています。反映まで数分お待ちください。" memcache.set(BbsConst.OBJECT_THREAD_MESSAGE_HEADER+str(thread.key()),message,BbsConst.OBJECT_THREAD_MESSAGE_CACHE_TIME) memcache.set(BbsConst.OBJECT_BBS_MESSAGE_HEADER+str(bbs.key()),message,BbsConst.OBJECT_BBS_MESSAGE_CACHE_TIME) #スレッドと掲示板の情報を更新 if(not overwrite): self.update_thread_and_bbs_information(thread,bbs,entry) #上書き投稿時の昔のイラストの削除 if(delete_thread_image): delete_thread_image.delete() #ステータスコードを出力 if(self.request.get('image')): self.response.headers ['Content-type'] = "text/html;charset=utf-8" self.response.out.write("success") else: url=MappingThreadId.get_thread_url("./",bbs,thread) if(self.request.get("redirect_url")): url=self.request.get("redirect_url") self.redirect(str(url)) #二重投稿ブロック memcache.set("add_entry_double_block",self.request.get("comment"),30) #ランキング is_owner=False if(thread.user_id and entry.user_id and thread.user_id == entry.user_id): is_owner=True if(not is_owner): #自分のスレッドへのコメントはランキングに反映しない Ranking.add_rank_global(thread,BbsConst.SCORE_ENTRY) #フィード if(not link_to_profile): user=None try: StackFeed.feed_new_comment_thread(user,thread,entry) except: logging.error("new entry stackfeed add error")
def get(self): SetUtf8.set() page_name = "" mode = "access" if self.request.get("mode"): mode = self.request.get("mode") bbs = None user = None if page_name == "": try: bbs = db.get(self.request.get("bbs_key")) except: bbs = None if bbs == None: Alert.alert_msg_notfound(self) return user = users.get_current_user() if user: if bbs.user_id != user.user_id(): user = None page_name = bbs.bbs_name if self.request.get("start_date"): start_date = self.request.get("start_date") if not self.validate_date(start_date): Alert.alert_msg_with_write(self, "日付指定は0000-00-00形式である必要があります。") return else: start_date = str(datetime.date.today() + datetime.timedelta(days=-31)) if self.request.get("end_date"): end_date = self.request.get("end_date") if not self.validate_date(end_date): Alert.alert_msg_with_write(self, "日付指定は0000-00-00形式である必要があります。") return else: end_date = str(datetime.date.today() + datetime.timedelta(days=-1)) start_day = datetime.datetime.strptime(start_date, "%Y-%m-%d") end_day = datetime.datetime.strptime(end_date, "%Y-%m-%d") if start_day > end_day: Alert.alert_msg_with_write(self, "終了日よりも開始日の方が大きくなっています。") return bbs_id = bbs.short is_admin = OwnerCheck.is_admin(user) if is_admin: if self.request.get("bbs_id"): bbs_id = self.request.get("bbs_id") if bbs.short != bbs_id: page_name = bbs_id page_list = None ref_list = None keyword_list = None access_list = None show_analyze = False if user or bbs.short == "sample": show_analyze = True if show_analyze: try: result = self.get_analytics(mode, bbs_id, start_date, end_date) except: time.sleep(1) try: result = self.get_analytics(mode, bbs_id, start_date, end_date) except: Alert.alert_msg_with_write(self, "Analytics APIへのアクセスに失敗しました。リロードして下さい") logging.error("failed analytics api") return if mode == "page": page_list = result if mode == "ref": ref_list = result if mode == "keyword": keyword_list = result if mode == "access": access_list = result quota_error = mode == "access" and not access_list redirect_api = ( "analyze?start_date=" + start_date + "&end_date=" + end_date + "&bbs_id=" + bbs_id + "&bbs_key=" + str(bbs.key()) + "&" ) host_url = "./" template_values = { "host": host_url, "mode": mode, "redirect_api": redirect_api, "quota_error": quota_error, "bbs": bbs, "bbs_id": bbs_id, "page_name": page_name, "is_admin": is_admin, "user": user, "show_analyze": show_analyze, "ref_list": ref_list, "page_list": page_list, "keyword_list": keyword_list, "access_list": access_list, "start_date": start_date, "end_date": end_date, "is_iphone": CssDesign.is_iphone(self), "is_tablet": CssDesign.is_tablet(self), "is_english": CssDesign.is_english(self), "redirect_url": self.request.path, } path = "/html/analyze.html" self.response.out.write(template_select.render(path, template_values))
def post(self): SetUtf8.set() mode = self.request.get("mode") name = self.request.get("name") profile = self.request.get("profile") homepage = self.request.get("homepage") mail = self.request.get("mail") twitter = self.request.get("twitter") birthday_year = self.request.get("birthday_year") birthday_month = self.request.get("birthday_month") birthday_day = self.request.get("birthday_day") regulation=0 if(self.request.get("regulation_r15_nl")): regulation+=1 if(self.request.get("regulation_r15_bl")): regulation+=2 if(self.request.get("regulation_r15_gl")): regulation+=4 privacy_rental_bbs=1 if(self.request.get("privacy_rental_bbs")): privacy_rental_bbs=0 disable_global_tweet=1 if(self.request.get("privacy_tweet")): disable_global_tweet=0 disable_rankwatch=1 if(self.request.get("privacy_user_ranking")): disable_rankwatch=0 if(disable_global_tweet): cache_id=BbsConst.OBJECT_CACHE_HEADER+BbsConst.OBJECT_TWEET_LIST_HEADER memcache.delete(cache_id) is_english=CssDesign.is_english(self) if(name==""): if(is_english): Alert.alert_msg_with_write(self,"No name"); else: Alert.alert_msg_with_write(self,"名前がありません。"); return #if(profile==""): # Alert.alert_msg_with_write(self,"プロフィールがありません。"); # return user = users.get_current_user() if(not(user)): Alert.alert_msg_with_write(self,"ログインが必要です。"); return bookmark=ApiObject.get_bookmark_of_user_id_for_write(user.user_id()) if(bookmark==None): Alert.alert_msg_with_write(self,"プロフィールの取得に失敗しました。"); return profile = cgi.escape(profile) compiled_line = re.compile("\r\n|\r|\n") profile = compiled_line.sub(r'<br/>', profile) if(mail=="None"): mail="" if(homepage=="None"): homepage="" if(twitter=="None"): twitter="" bookmark.name=name bookmark.profile=profile bookmark.mail=mail bookmark.twitter_id=twitter bookmark.homepage=homepage bookmark.owner=user bookmark.disable_rankwatch=disable_rankwatch bookmark.disable_global_tweet=disable_global_tweet bookmark.regulation=regulation bookmark.privacy_rental_bbs=privacy_rental_bbs if(self.request.get("my_color")=="" or self.request.get("my_color")=="#f2f2f2"): bookmark.my_color=None else: bookmark.my_color=self.request.get("my_color") bookmark.sex=int(self.request.get("sex")) if(birthday_year): try: birthday_year=int(birthday_year) except: if is_english: Alert.alert_msg_with_write(self,"Birthday must be number"); else: Alert.alert_msg_with_write(self,"生まれた年は半角数字である必要があります。"); return else: birthday_year=0 if(birthday_month): try: birthday_month=int(birthday_month) except: if is_english: Alert.alert_msg_with_write(self,"Birthday must be number"); else: Alert.alert_msg_with_write(self,"生まれた月は半角数字である必要があります。"); return else: birthday_month=0 if(birthday_day): try: birthday_day=int(birthday_day) except: if is_english: Alert.alert_msg_with_write(self,"Birthday must be number"); else: Alert.alert_msg_with_write(self,"生まれた日は半角数字である必要があります。"); return else: birthday_day=0 bookmark.birthday_year=birthday_year bookmark.birthday_month=birthday_month bookmark.birthday_day=birthday_day bookmark.icon_mini=None #サムネイルの再作成を要求 bookmark.thumbnail_created=0 age=Pinterest.get_age(bookmark) if(bookmark.regulation and age>=1 and age<=14): Alert.alert_msg_with_write(self,"制限付きコンテンツを表示するには15歳以上である必要があります。"); return if(self.request.get("icon")): bookmark.icon=db.Blob(self.request.get("icon")) img = self.request.body_file.vars['icon'] bookmark.icon_content_type=img.headers['content-type'] if(not ApiObject.create_user_thumbnail(bookmark)): if is_english: Alert.alert_msg_with_write(self,"Too big icon image"); else: Alert.alert_msg_with_write(self,"アイコン画像が大きすぎます。"); return try: SyncPut.put_sync(bookmark) except: Alert.alert_msg_with_write(self,"データストアへの保存に失敗しました。アイコンの容量が1MBを超えている場合は縮小してからアップロードして下さい。"); return self.redirect(str("./mypage"))
def get(self,bbs_key): #日本語対応 SetUtf8.set() #英語版かどうか is_english=CssDesign.is_english(self) #メンテナンス中かどうか is_maintenance=0 if(MaintenanceCheck.is_appengine_maintenance()): is_maintenance=1 #掲示板を取得 bbs=ShowBbs.get_bbs(self,bbs_key) if(bbs==None): return #掲示板削除チェック if(bbs.del_flag) : if(is_english): Alert.alert_msg_with_write(self,"This bbs was deleted.") else: Alert.alert_msg_with_write(self,"この掲示板は削除されました。") return #ページ取得 page = 1 if self.request.get("page"): try: page = int(self.request.get("page")) except: Alert.alert_msg_with_write(self,"ページ番号が異常です。") return if page<1 : page=1 #描画順を取得 order=ShowBbs.get_order(self,bbs) #カテゴリ取得 category="" if(self.request.get("category")): category=self.request.get("category") #スレッド一覧を取得 thread_query=ShowBbs.get_thread_query(bbs,category,order) #1ページのイラスト数を取得 col_num=ShowBbs.get_col_num(bbs,order) #スレッド数とスレッドを取得 count_limit=(BbsConst.PAGE_LIST_COUNT+page)*col_num #ページ番号生成用にしか使わないのでページ番号のMaxがわかれば良い if(category==""): threads_num = bbs.cached_threads_num else: threads_num = thread_query.count(limit=count_limit) all_threads = thread_query.fetch(limit=col_num, offset=(page-1)*col_num) #返信イラストを取得 all_entries = None #if(order=="thumbnail"): # all_entries=ShowBbs.get_illust_reply(bbs,page,col_num) # if(threads_num<all_entries["count"]): # threads_num=all_entries["count"] # all_entries=all_entries["entry"] #ホストURLを取得 host_url="http://"+MappingId.mapping_host(self.request.host)+"/"; #URLを作成 mapped_category=urllib.quote(category.encode('utf-8')) page_url=MappingId.get_usr_url(host_url,bbs) page_url_base=MappingId.get_usr_url(host_url,bbs)+'?order='+order+'&category='+mapped_category+'&page=' page_url_order_base=MappingId.get_usr_url(host_url,bbs)+'?page=1&category='+mapped_category+'&order=' page_url_category_base=MappingId.get_usr_url(host_url,bbs)+'?page=1&order='+order+"&category=" #ページリストを作成 page_list=PageGenerate.generate_page(page,threads_num,col_num) #ログインユーザを取得 user = users.get_current_user() logined=0 if(user): logined=1 owner=user if(OwnerCheck.check(bbs,user)): owner=None #サイドバーコメントを取得 side_comment=RecentCommentCache.get_entry(bbs) side_thread=RecentCommentCache.get_thread(bbs) #カテゴリ一覧を取得 category_list=None if(bbs.category_list): if(bbs.category_list!=""): category_list=CategoryList.get_category_list(bbs) #bbs.category_list.split(",") #ページデザインを取得 css_key=self.request.get("css_key") design=CssDesign.get_design_object(self,bbs,host_url,0) #サイドバー一覧を作成 sidebar_list=ShowBbs.get_sidebar(bbs,category_list,side_comment,side_thread) #新規スレッドを作成できるか can_create_thread=ShowBbs.get_can_create_thread(bbs,user,logined) can_create_new_image=ShowBbs.get_can_create_new_image(bbs,owner) #スレッドを全て取得 all_threads_cached=ApiObject.get_cached_object_list(all_threads) #コメントフォームを表示するか show_comment_form=1 if(bbs.comment_login_require and not(owner)): show_comment_form=0 #フルコメントデバッグ if(self.request.get("full_comment")): bbs.enable_full_comment=1 #フルフラット表示をデフォルト化 if(bbs.bbs_mode==BbsConst.BBS_MODE_NO_IMAGE): bbs.enable_full_flat=0 bbs.enable_full_comment=0 else: bbs.enable_full_flat=1 #bbs.enable_full_comment=1 #デフォルト化を止める #コメントを全て取得 #user_name="" user_name=ShowEntry.get_user_name(user) if(bbs.enable_full_comment): admin_user=OwnerCheck.is_admin(user) ShowEntry.render_comment_list(self,all_threads_cached,host_url,bbs,show_comment_form,logined,admin_user,user_name,user) #デザインの編集ができるか can_edit_design=False is_admin=OwnerCheck.is_admin(user) if(owner or (is_admin and bbs.bbs_mode==BbsConst.BBS_MODE_EVERYONE)): can_edit_design=True #infinite_scrollを使用するかどうか infinite_scroll=False #if(bbs.bbs_mode!=BbsConst.BBS_MODE_NO_IMAGE):# and design["is_iphone"]): infinite_scroll=True #infinite_scrollの2ページ目以降 contents_only=0 if(self.request.get("contents_only")=="1"): contents_only=1 #メッセージ message=memcache.get(BbsConst.OBJECT_BBS_MESSAGE_HEADER+str(bbs.key())) #カウントアップコメント if(bbs.counter): bbs.counter.new_day_update() count_up_comment=None #if(bbs.dont_count_owner): # if(owner): # count_up_comment="管理人" # else: # count_up_comment="ユーザ" #カテゴリリスト show_category_list=False if(self.request.get("show_category_list")=="1"): show_category_list=True #レンダリング template_values = { 'host': host_url, 'usrhost': MappingId.get_usr_url(host_url,bbs), 'threads': all_threads_cached, 'all_entries':all_entries, 'bbs':bbs, 'new_url': 'create_new_thread', 'page':page, 'page_url':page_url, 'page_url_base':page_url_base, 'order':order, 'page_url_order_base':page_url_order_base, 'page_list':page_list, 'user':user, 'owner': owner, 'side_comment':side_comment, 'side_thread':side_thread, 'logined':logined, 'can_create_thread':can_create_thread, 'category_list':category_list, 'page_url_category_base':page_url_category_base, 'now_category':category, 'can_create_new_image':can_create_new_image, 'template_path':design["template_path"], 'css_name':design["css_name"], 'is_iphone':design["is_iphone"], 'is_tablet':design["is_tablet"], 'template_base_color':design["template_base_color"], 'sidebar_list': sidebar_list, 'is_maintenance': is_maintenance, 'css_key': css_key, 'redirect_url': self.request.path, 'show_comment_form': show_comment_form, 'user_name': user_name, 'is_admin': is_admin, 'can_edit_design': can_edit_design, 'infinite_scroll': infinite_scroll, 'infinite_scroll_selecter': ".entry", 'contents_only': contents_only, 'message': message, 'is_english': is_english, 'count_up_comment': count_up_comment, 'show_category_list': show_category_list } path = "/html/"+design["base_name"] self.response.out.write(template_select.render(path, template_values)) if(is_maintenance): return CounterWorker.update_counter(self,bbs,None,owner)
def get(self): SetUtf8.set() if(ApiObject.check_api_capacity(self)): return dic=ApiFeed.get_core(self) ApiObject.write_json_core(self,dic)
def get(self): SetUtf8.set() #ブックマーク制御 user = users.get_current_user() bookmark=NicoTracker.get_bookmark(user) if(self.request.get("add_bookmark")): NicoTracker.add_bookmark(bookmark,self.request.get("id"),self.request.get("title")) if(self.request.get("del_bookmark")): NicoTracker.del_bookmark(bookmark,self.request.get("id")) url_log = users.create_logout_url(self.request.uri) if(not user): url_log = users.create_login_url(self.request.uri) url = ""#http://www.nicovideo.jp/watch/sm15521745" if(self.request.get("url")): url=self.request.get("url") if(url==""): rec=None else: if(url=="update_all"): rec=self.auto_update() else: rec=self.update_url(url) play_cnt_graph="" comment_cnt_graph="" list_tbl="" if(rec): #GRAPH play_cnt_graph=NicoTracker.create_graph(rec.day_list,rec.play_cnt_list); comment_cnt_graph=NicoTracker.create_graph(rec.day_list,rec.comment_cnt_list); #TABLE no=0 for day in rec.day_list: list_tbl+="<TR><TD>"+day+"</TD>" list_tbl+="<TD>"+rec.play_cnt_list[no]+"</TD>" list_tbl+="<TD>"+rec.comment_cnt_list[no]+"</TD></TR>\n" no=no+1 query=NicoTrackerRec.all() rec_cnt=query.count(limit=100000) rec_list=query.order("-play_cnt_now").fetch(limit=10) query=NicoTrackerBookmark.all() book_cnt=query.count() bookmark_list=[] if(bookmark): for i in range(0,len(bookmark.bookmark_id_list)): playcnt=0 try: playcnt=NicoTrackerRec.all().filter("id =",bookmark.bookmark_id_list[i])[0].play_cnt_now except: playcnt=0 if(playcnt==None): playcnt=0 url_base="http://www.nicovideo.jp/watch/" #del_button="<div class='delete_button' onClick='click_delete(\"" del_button="<img src='static_files/nicotra/book.gif' onClick='click_delete(\"" del_button+=bookmark.bookmark_id_list[i] del_button+="\",\""+url+"\");'>"; #del_button+="del</div>"; title=bookmark.bookmark_title_list[i].split(" ‐ ")[0] #if(len(title)>=30): # title=title[0:30]+"…" bookmark_list.append(del_button+"<A HREF='nico_tracker?url="+url_base+bookmark.bookmark_id_list[i]+"'>"+title+"</A> "+str(playcnt)+"[play] "); is_anim_icon=self.request.get("is_anim_icon") host_url =self.request.host template_values = { 'host': host_url, 'rec': rec, 'rec_list': rec_list, 'url': url, 'play_cnt_graph': play_cnt_graph, 'comment_cnt_graph': comment_cnt_graph, 'list_tbl': list_tbl, 'rec_cnt': rec_cnt, 'user': user, 'bookmark_list': bookmark_list, 'url_log': url_log, 'is_anim_icon': is_anim_icon, 'book_cnt': book_cnt } path = '/html/nico_tracker/nico_tracker.html' render=template_select.render(path, template_values) self.response.out.write(render)
def get(self,regist_mode): SetUtf8.set() #表示モードかどうか view_mode=None if(self.request.get("user")): view_mode=self.request.get("user") #ユーザ検索 if(self.request.get("user_id")): target_bookmark=ApiObject.get_bookmark_of_user_id(self.request.get("user_id")) if(target_bookmark==None): Alert.alert_msg_with_write(self,"ユーザが見つかりません。") return view_mode=str(target_bookmark.key()); #リダイレクトURL host=MappingId.mapping_host_with_scheme(self.request)+"/"; redirect_url=host+"mypage"; #編集モードか edit_mode=0 if(self.request.get("edit")): edit_mode=int(self.request.get("edit")) #掲示板一覧 user = users.get_current_user() favorite="" bookmark=None #管理人かどうか is_admin=0 if(OwnerCheck.is_admin(user)):# and self.request.get("is_admin")): is_admin=1 #自分だったらビューモードにしない if(user and self.request.get("user_id")==user.user_id() and not self.request.get("withdraw")): view_mode=0 #ログインしているか login_flag=0 if(user): login_flag=1 #表示設定 if(view_mode): bookmark=db.get(view_mode) else: if user: bookmark=ApiObject.get_bookmark_of_user_id(user.user_id()) else: bookmark=None #掲示板の新規作成が完了したか regist_finish=False if(regist_mode=="regist"): regist_finish=True #プロフィールを編集 edit_profile=Pinterest.get_profile_for_edit(bookmark,view_mode) #アカウントの凍結 if(self.request.get("freez") and is_admin): bookmark=ApiObject.get_bookmark_of_user_id_for_write(self.request.get("user_id")) bookmark.frozen=int(self.request.get("freez")) bookmark.put() #退会 if(self.request.get("withdraw") and self.request.get("withdraw")=="go"): if(not bookmark): Alert.alert_msg_with_write(self,"ユーザ情報は未登録です。"); return your_bbs_count=Bbs.all().filter("del_flag =",0).filter("user_id =",bookmark.user_id).count() if(self.withdraw(bookmark,your_bbs_count)): return; #リダイレクト if(BbsConst.PINTEREST_MODE): if((user and OwnerCheck.is_admin(user)) or BbsConst.PINTEREST_MODE==2): if(regist_finish): return Pinterest.get_core(self,Pinterest.PAGE_MODE_REGIST) else: return Pinterest.get_core(self,Pinterest.PAGE_MODE_MYPAGE)