Exemple #1
0
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)
Exemple #2
0
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)
Exemple #3
0
def delete(id):
    Comment.delete().where(Comment.id == id).execute()