示例#1
0
文件: blog.py 项目: radjah/point-www
def unrecommend(id):
    comment_id = env.request.args('comment_id')
    try:
        posts.unrecommend(id, comment_id)
    except RecommendationNotFound:
        pass

    return Response(redirect=env.request.referer)
示例#2
0
def recommend(post_id, comment_id=None, text=None):
    try:
        try:
            posts.recommend(post_id, comment_id, text)
            return xmpp_template('recommendation_sent',
                                  post_id=post_id, comment_id=comment_id)
        except RecommendationExists:
            try:
                posts.unrecommend(post_id, comment_id)
                return xmpp_template('recommendation_cancel_sent',
                                      post_id=post_id, comment_id=comment_id)
            except RecommendationNotFound:
                pass
    except PostNotFound:
        return xmpp_template('post_not_found', post_id=post_id)
    except CommentNotFound:
        return xmpp_template('comment_not_found', post_id=post_id,
                                                  comment_id=comment_id)
    except RecommendationError:
        return xmpp_template('post_recommend_denied', post_id=post_id)
    except PostAuthorError:
        return xmpp_template('post_denied', post_id=post_id)
示例#3
0
def unrecommend_comment(id, comment_id):
    posts.unrecommend(id, comment_id)
示例#4
0
def unrecommend_post(id):
    posts.unrecommend(id, None)