Exemplo n.º 1
0
def unpin(id):
    post = Post(id)
    if env.user.id == post.author.id:
        post.set_pinned(False)
        return Response(redirect=env.request.referer)
    else:
        raise Forbidden
Exemplo n.º 2
0
def unpin(id):
    post = Post(id)
    if env.user.id == post.author.id:
        post.set_pinned(False)
        return Response(redirect=env.request.referer)
    else:
        raise Forbidden
Exemplo n.º 3
0
def unpin_post(post_id):
    try:
        post = Post(id)
        if env.user.id == post.author.id:
            if post.pinned:
                post.set_pinned(False)
                return xmpp_template('post_unpinned', post_id=post_id)
            else:
                raise PostNotPinnedError
        else:
            raise PostAuthorError
    except PostAuthorError:
        return xmpp_template('post_denied', post_id=post_id)
    except PostNotPinnedError:
        return xmpp_template('post_not_pinned', post_id=post_id)
    except PostNotFound:
        return xmpp_template('post_not_found', post_id=post_id)
Exemplo n.º 4
0
def unpin_post(post_id):
    try:
        post = Post(id)
        if env.user.id == post.author.id:
            if post.pinned:
                post.set_pinned(False)
                return xmpp_template('post_unpinned', post_id=post_id)
            else:
                raise PostNotPinnedError
        else:
            raise PostAuthorError
    except PostAuthorError:
        return xmpp_template('post_denied', post_id=post_id)
    except PostNotPinnedError:
        return xmpp_template('post_not_pinned', post_id=post_id)
    except PostNotFound:
        return xmpp_template('post_not_found', post_id=post_id)