def get(self): super(ModeratorAction_CommentDelete, self).get() comment_key = self.request.get('key') comment = VPageComment.get(comment_key) VPageComment.delete(comment) if self.request.get('return'): self.redirect(self.request.get('return'))
def get(self): super(ModeratorPage_RecentComments, self).get() start_index = 0 if self.request.get('start'): start_index = int(self.request.get('start')) page_size = 10 comments = VPageComment.all().order('-date').fetch( page_size + 1, start_index) prev_page_url = None next_page_url = None if start_index > 0: if start_index - page_size > 0: prev_page_url = '/moderator/comments?start=' + str( start_index - page_size) else: prev_page_url = '/moderator/comments' if len(comments) > page_size: next_page_url = '/moderator/comments?start=' + str(start_index + page_size) comments = comments[:-1] template_values = { 'comments': comments, 'prev_page_url': prev_page_url, 'next_page_url': next_page_url } self.write_template('html.core/moderator-recent-comments.html', template_values)
def get(self): super(ModeratorPage_CommentEdit, self).get() comment_key = self.request.get('key') return_target = self.request.get('return') comment = VPageComment.get(comment_key) template_values = {'comment': comment, 'return_target': return_target} self.write_template('html.core/moderator-comment-edit.html', template_values)
def post(self): super(ModeratorAction_CommentChange, self).post() comment_key = self.request.get('key') return_target = self.request.get('return') comment = VPageComment.get(comment_key) comment.content = self.request.get('content') comment.put() if return_target: self.redirect(return_target)
def get(self,*ar): page_name = ar[0] page = VPage.all().filter('name',page_name).get() if page: comments = VPageComment.all().filter('page_ref', page) template_values = { 'page': page, 'comments': comments } self.write_template('html.template/page-show.html', template_values) else: raise BasicRequestHandlerException(404,'Page not found name='''+page_name+"'")
def post(self): if self.user_info.banned: raise BasicRequestHandlerException(403,'User banned') page_key = self.request.get('key') page = VPage.get(page_key) comment = VPageComment() comment.content = self.request.get('content') comment.visible = True comment.page_ref = page comment.put() self.redirect('/page/'+page.name)
def get(self): super(ModeratorAction_CommentUserBan, self).get() comment_key = self.request.get('key') comment = VPageComment.get(comment_key) vuser = VUser.all().filter('user ='******'alert("User banned")')