def comment_delete(id): comment = Comment.get_by_id(id) if comment is None or not comment.can_delete: abort(403) post = comment.post try: Comment.delete(id) message = _('COMMENT_DELETE_SUCCESS') except Exception as e: message = _('ERROR_COMMENT_DELETE_FAILED', error=e) return render_view(url_for('stamp.show', id=post.id), redirect=True, message=message)
def delete(id): Comment.delete().where(Comment.id == id).execute()