예제 #1
0
파일: user.py 프로젝트: jtwmyddsgx/1024
 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")
예제 #2
0
파일: article.py 프로젝트: jtwmyddsgx/1024
 def post(self, *args, **kwargs):
     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):
         Comment.dele_by_key(comment_key)
         return self.write("删除成功")
     else:
         self.send_error(404)