def post(self, post_id): key = db.Key.from_path('Comment', int(post_id), parent=blog_key()) comment = db.get(key) if not BlogHandler.comment_exists(self, comment): self.redirect('/') else: postID = comment.post if BlogHandler.user_logged_in(self): if BlogHandler.user_owns_comment(self, comment): db.delete(key) self.redirect("/deletedcomment/%s" % postID) else: self.redirect('/') else: self.redirect('/')
def post(self, post_id): key = db.Key.from_path('Comment', int(post_id), parent=blog_key()) comment = db.get(key) if not BlogHandler.comment_exists(self, comment): self.redirect('/') else: returnPost = comment.post if not BlogHandler.user_logged_in(self): self.redirect('/login') else: if BlogHandler.user_owns_comment(self, comment): comment.text = self.request.get('commentText') comment.put() self.redirect('/%s' % returnPost) else: self.redirect('/%s' % returnPost)
def post(self, post_id): key = db.Key.from_path('Comment', int(post_id), parent=blog_key()) comment = db.get(key) if not BlogHandler.comment_exists(self, comment): self.redirect('/') else: if not BlogHandler.user_logged_in(self): self.redirect('/login') else: if BlogHandler.user_owns_comment(self, comment): commentID = comment.key().id() commentText = comment.text postID = comment.post self.render('editcomment.html', commentText=commentText, commentID=commentID, postID=postID) else: self.redirect('/')