Ejemplo n.º 1
0
 def get(self, post_id, comment_id):
     if self.user:
         c = Comment.check_if_user_owns_comment(comment_id, self.user.name)
         if c:
             c.delete()
             self.redirect('/blog/%s' % post_id)
         else:
             error = "Oops, this is not your comment"
             self.render("error.html", error=error)
Ejemplo n.º 2
0
    def post(self, post_id, comment_id):
        a = Article.check_if_valid_post(post_id)
        c = Comment.check_if_user_owns_comment(comment_id, self.user.name)
        if a and c:
            comment = self.request.get('comment')
            if comment:
                c.comment = comment
                c.put()
                self.redirect('/blog/%s' % post_id)
            else:
                error = "Please input comment"
                self.redner("comment.html", error=error, c=c)

        else:
            error = "Oops, this is not your comment"
            self.render("error.html", error=error)