コード例 #1
0
ファイル: index.py プロジェクト: gabriel-tessier/HeadsUp
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)
コード例 #2
0
ファイル: index.py プロジェクト: jctt1983/PythonBlog
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)
コード例 #3
0
ファイル: comment.py プロジェクト: rayandas/tuesday
def delete(id):
    Comment.delete().where(Comment.id == id).execute()