def get(self,slug,key,p="1"): dis = get_or_404(Discussion.get_discussion_by_key,slug,key) p = int(p) #check ACL check_roles(self,dis.role) #handler visit log if not self.user is None: key = "%s%s" %(self.user.name_lower,self.p) logs = memcache.get(":visitlogs:") if logs is None: logs = set([]) logs.add(key) memcache.set(":visitlogs:",logs,3600) self.template_value['f_tag']={'key':dis.tag_slug,'title':dis.tag_title,'show':'G' in dis.role,'post':True} self.template_value['disviews']=ShardCount.get_increment_count("disviews:"+key,"disviews") self.template_value['dis']=dis bookmark = Bookmark.get_bookmark(self.user,dis) if self.user else None self.template_value['bookmark'] = bookmark #comment page comments = PagedQuery(Comment.get_by_dis(dis),self.setting.comment_pagesize) temp = comments.fetch_page(p) self.template_value['prev']= p-1 if p>1 else None self.template_value['next']= p+1 if len(temp) == self.setting.comment_pagesize else None self.template_value['comments'] = temp self.template_value['p']=p self.render("dis.html")
def get(self,slug): p = int(self.request.get("p","1")) tag = get_or_404(Tag.get_tag_by_slug,slug) #check ACL check_roles(self,tag.role) self.p = p get_cell(tag.tag_type).tag_list(self,tag)
def post(self,slug): tag = get_or_404(Tag.get_tag_by_slug,slug) #check ACL check_roles(self,tag.role) check_roles(self,tag.add_role) self.m = 'post' get_cell(tag.tag_type).add(self,tag)
def get(self, slug): tag = get_or_404(Tag.get_tag_by_slug, slug) # check ACL check_roles(self, tag.role) check_roles(self, tag.add_role) # addrole self.m = "get" get_cell(tag.tag_type).add(self, tag)
def get(self,slug,key): dis = get_or_404(Discussion.get_discussion_by_key,slug,key) #check ACL check_roles(self,dis.role) if dis.user_name != self.user.name : return self.error(403) #shoud be 403 :) self.m = 'get' get_cell(dis.tag.tag_type).edit(self,dis)
def get(self, slug, key, p="1"): dis = get_or_404(Discussion.get_discussion_by_key, slug, key) p = int(p) # check ACL check_roles(self, dis.role) # handler visit log if not self.user is None: key = "%s%s" % (self.user.name_lower, self.p) logs = memcache.get(":visitlogs:") if logs is None: logs = set([]) logs.add(key) memcache.set(":visitlogs:", logs, 3600) self.template_value["f_tag"] = { "key": dis.tag_slug, "title": dis.tag_title, "show": "G" in dis.role, "post": True, } # self.template_value['disviews']= dis.count_view = ShardCount.get_increment_count("disviews:" + key, "disviews") dis.put() self.template_value["dis"] = dis bookmark = Bookmark.get_bookmark(self.user, dis) if self.user else None self.template_value["bookmark"] = bookmark # comment page comments = PagedQuery(Comment.get_by_dis(dis), self.setting.comment_pagesize) temp = comments.fetch_page(p) self.template_value["prev"] = p - 1 if p > 1 else None self.template_value["next"] = p + 1 if len(temp) == self.setting.comment_pagesize else None self.template_value["comments"] = temp self.template_value["p"] = p self.render("dis.html")