Exemple #1
0
 def post(self, *args, **kwargs):
     stype = args[0]
     if stype == "1":
         article_key = self.get_argument("theKey", "")
         user = self.current_user()
         article = Article.get_by_key(article_key)
         if article_key != "" and(user.level == 100 or user.username == article.username):
             if Article.dele_by_key(article_key):
                 Comment.dele_by_article(article_key)
                 self.write("删除成功!")
             else:
                 self.send_error(404)
         else:
             self.send_error(404)
     if stype == "2":
         comment_key = self.get_argument("theKey", "")
         user = self.current_user()
         comment = Comment.get_by_key(comment_key)
         if comment_key != "" and (user.level == 100 or user.username == comment.username):
             if Comment.dele_by_key(comment_key):
                 self.write("删除成功!")
             else:
                 self.send_error(404)
         else:
             self.send_error(404)
     else:
         self.redirect("/user/personal/manager/1")
Exemple #2
0
 def post(self, *args, **kwargs):
     key = self.get_argument("theKey", "")
     user = self.current_user()
     article = Article.get_by_key(key)
     if key != "" and(user.level == 100 or user.username == article.username):
         if Article.dele_by_key(key):
             Comment.dele_by_article(key)
             self.write("删除成功!")
         else:
             self.send_error(404)
     else:
         self.send_error(404)