Example #1
0
    def handle_post(self, data):
        """Handle post
        """
        if data['private']:
            return

        if len(data['tags']) == 0 or 'point' not in data['tags']:
            return

        tagset = set(data['tags'])

        if tagset & FR_TAGS:
            issue_type = 'enhancement'
        elif tagset & BUG_TAGS:
            issue_type = 'bug'
        else:
            return

        if cache_get('issue-post:%s' % data['post_id']):
            return

        text = template('report.md', **data)

        args = {
            'kind': issue_type,
            'title': data['text'][:100],
            'content': text,
        }

        bb = Bitbucket(settings.api_login, settings.api_password,
                       settings.api_slug)

        issue = Issue(bb)
        status, resp = issue.create(**args)

        try:
            env.user = User('login', 'support')
        except UserNotFound:
            return

        reply = template('reply.txt', issue=resp['local_id'])

        try:
            add_comment(data['post_id'], None, text=reply,
                        dont_subscribe=True, force=True)
        except (PostError, CommentError), e:
            log.error(e)
            return
Example #2
0
def add_comment(id):
    to_comment_id = env.request.args('comment_id')
    text = env.request.args('text', '').strip()

    comment_id = posts.add_comment(id, to_comment_id, text)

    return {"id": id, "comment_id": comment_id}
Example #3
0
def add_comment(id):
    to_comment_id = env.request.args('comment_id')
    text = env.request.args('text', '').strip()

    comment_id = posts.add_comment(id, to_comment_id, text)

    return {"id": id, "comment_id": comment_id}
Example #4
0
def add_comment(id):
    to_comment_id = env.request.args("comment_id")
    text = env.request.args("text", "").strip()

    comment_id = posts.add_comment(id, to_comment_id, text)

    return {"id": id, "comment_id": comment_id}
Example #5
0
def add_comment(post_id, to_comment_id, text):
    try:
        comment_id = posts.add_comment(post_id, to_comment_id, text)
    except PostTextError:
        return xmpp_template('post_inadmissible')
    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=to_comment_id)
    except (PostAuthorError, SubscribeError):
        return xmpp_template('post_denied', post_id=post_id)

    return xmpp_template('msg_comment_sent', post_id=post_id,
                                             comment_id=comment_id)
Example #6
0
def add_comment(post_id, to_comment_id, text):
    try:
        comment_id = posts.add_comment(post_id, to_comment_id, text)
    except PostTextError:
        return xmpp_template('post_inadmissible')
    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=to_comment_id)
    except (PostAuthorError, SubscribeError):
        return xmpp_template('post_denied', post_id=post_id)

    return xmpp_template('msg_comment_sent',
                         post_id=post_id,
                         comment_id=comment_id)
Example #7
0
def add_comment(id):
    to_comment_id = env.request.args('comment_id')
    text = env.request.args('text', '').strip()
    files = _files([])

    try:
        comment_id = posts.add_comment(id, to_comment_id, text, files=files)
    except PostTextError:
        return render('/comment-error.html')

    if env.owner and env.owner.login:
        login = env.owner.login.lower()
    else:
        post = Post(id)
        login = post.author.login.lower()

    return Response(redirect='%s://%s.%s/%s#%s' % \
                             (env.request.protocol,
                              login, settings.domain, id, comment_id))
Example #8
0
def add_comment(id):
    to_comment_id = env.request.args('comment_id')
    text = env.request.args('text', '').strip()
    files = _files([])

    try:
        comment_id = posts.add_comment(id, to_comment_id, text, files=files)
    except PostTextError:
        return render('/comment-error.html')

    if env.owner and env.owner.login:
        login = env.owner.login.lower()
    else:
        post = Post(id)
        login = post.author.login.lower()

    return Response(redirect='%s://%s.%s/%s#%s' % \
                             (env.request.protocol,
                              login, settings.domain, id, comment_id))