def get(self, comment_id=None): comment_id = int( comment_id ) comment = Comment.get_by_id( comment_id ) if not comment: self.siteError( SiteErrorType.ERROR_COMMENT_NOT_EXIST ) return self.context['comment'] = comment self.render('admin/delete_comment.html') pass
def post(self, comment_id=None): comment_id = int( comment_id ) comment = Comment.get_by_id( comment_id ) if not comment: self.siteError( SiteErrorType.ERROR_COMMENT_NOT_EXIST ) return siteUser = User.getSiteUser( comment.user ) Comment.delete_comment(comment) is_spam = self.request.get('is_spam') if is_spam: siteUser.status = UserStatus.USER_BANED siteUser.put() site_user_id = siteUser.key().id() # delete user's comment Comment.delete_with_user_id(site_user_id) # delete user's entry Entry.delete_with_user_id(site_user_id) self.redirect( '/admin/comment' )