Exemplo n.º 1
0
def api_delete_comments(id, request):
    check_admin(request)
    c = yield from Comment.find(id)
    if c is None:
        raise APIResourceNotFoundError('Comment')
    yield from c.remove()
    return dict(id=id)
Exemplo n.º 2
0
def api_delete_comments(id, request):
    check_admin(request)
    c = yield from Comment.find(id)
    if c is None:
        raise ApiResourceNotFoundError('Comment')
    yield from c.remove()
    return dict(id=id)
Exemplo n.º 3
0
async def api_delete_comment(id, request):
    check_admin(request)
    comment = Comment.find(id)
    if comment is None:
        raise APIResourceNotFoundError('Comment')
    await comment.remove()
    return dict(id=id)
Exemplo n.º 4
0
def delete_comment(post_id, comment_id):
    user = SESSION.get(request.headers.get('Authorization'))
    if user is None:
        abort(400, {'message': 'TOKEN_NOT_FOUND'})
    from model import Comment
    comment_exist = Comment.find(comment_id)   
    if comment_exist is None:
        abort(400, {'message': 'COMMENT_NOT_FOUND'})
    comment_exist.delete()
    return "DELETED"