예제 #1
0
def format_issue_comment_info(**kw):
    from vilya.models.issue_comment import IssueComment
    issue_id = kw['issue_id']
    author = kw['author']
    content = kw['content']
    comment_id = kw['comment_id']

    issue = get_issue_by_issue_id(issue_id)
    target = issue.target

    issue_comment = IssueComment.get(comment_id)
    text = trunc_utf8(content, 50)
    uid = "issue-comment-%s-%s-%s-%s" % (issue.target_type, target.id,
                                         issue.number, issue_comment.number)
    type = 'issue_comment'
    data = dict(
        date=datetime.now(),
        url="%s#comment-%s" % (issue.url, issue_comment.number),
        number=issue.number,
        title=issue.title,
        target_name="%s" % target.name,
        target_url="%s" % target.url,
        receiver=issue.creator_id,
        author=author,
        text=text,
        uid=uid,
        type=type,
    )
    return data
예제 #2
0
파일: team.py 프로젝트: leeccong/code
 def _q_lookup(self, request, comment_id):
     comment = IssueComment.get(comment_id)
     if not comment:
         raise TraversalError("Unable to find issue comment %s" % comment_id)
     else:
         self.comment = comment
         return self
예제 #3
0
 def test_update_comment(self):
     i = Issue.add('test', 'test description', 'test', 'assignee')
     c = IssueComment.add(i.id, 'content', 'test')
     c.update('content1')
     c = IssueComment.get(c.id)
     assert c.issue_id == i.id
     assert c.content == 'content1'
     assert c.author_id == 'test'
예제 #4
0
파일: issue.py 프로젝트: jackfrued/code-1
 def _q_lookup(self, request, comment_id):
     comment = IssueComment.get(comment_id)
     if not comment:
         raise TraversalError("Unable to find issue comment %s" %
                              comment_id)
     else:
         self.comment = comment
         return self
예제 #5
0
 def test_update_comment(self):
     i = Issue.add('test', 'test description', 'test', 'assignee')
     c = IssueComment.add(i.id, 'content', 'test')
     c.update('content1')
     c = IssueComment.get(c.id)
     assert c.issue_id == i.id
     assert c.content == 'content1'
     assert c.author_id == 'test'
예제 #6
0
    def test_get_comment(self):
        i = Issue.add('test', 'test description', 'test', 'assignee')
        c = IssueComment.add(i.id, 'content', 'test')
        c = IssueComment.get(c.id)
        assert isinstance(c, IssueComment)
        assert c.issue_id == i.id
        assert c.content == 'content'
        assert c.author_id == 'test'

        c = IssueComment.add(i.id, 'content', 'test')
        cs = IssueComment.gets_by_issue_id(i.id)
        assert all([isinstance(t, IssueComment) for t in cs])
        assert len(cs) == 2
예제 #7
0
    def test_get_comment(self):
        i = Issue.add('test', 'test description', 'test', 'assignee')
        c = IssueComment.add(i.id, 'content', 'test')
        c = IssueComment.get(c.id)
        assert isinstance(c, IssueComment)
        assert c.issue_id == i.id
        assert c.content == 'content'
        assert c.author_id == 'test'

        c = IssueComment.add(i.id, 'content', 'test')
        cs = IssueComment.gets_by_issue_id(i.id)
        assert all([isinstance(t, IssueComment) for t in cs])
        assert len(cs) == 2
예제 #8
0
파일: team.py 프로젝트: leeccong/code
 def edit(self, request):
     if request.method == "POST":
         user = request.user
         current_user = request.user
         if self.comment.author_id != user.username:
             raise AccessError
         team = self.team
         content = request.get_form_var("pull_request_comment", "").decode("utf-8")
         self.comment.update(content)
         comment = IssueComment.get(self.comment.id)
         author = user
         target = team
         return dict(r=0, html=st("/widgets/issue/issue_comment.html", **locals()))
예제 #9
0
파일: issue.py 프로젝트: 000fan000/code
 def edit(self, request):
     if request.method == 'POST':
         user = request.user
         current_user = request.user
         if self.comment.author_id != user.username:
             raise AccessError
         project = self.project
         content = request.get_form_var(
             'pull_request_comment', '').decode('utf-8')
         self.comment.update(content)
         comment = IssueComment.get(self.comment.id)
         author = user
         target = project
         return dict(
             r=0, html=st('/widgets/issue/issue_comment.html', **locals()))
예제 #10
0
파일: issue.py 프로젝트: jackfrued/code-1
 def edit(self, request):
     if request.method == 'POST':
         user = request.user
         current_user = request.user
         if self.comment.author_id != user.username:
             raise AccessError
         project = self.project
         content = request.get_form_var('pull_request_comment',
                                        '').decode('utf-8')
         self.comment.update(content)
         comment = IssueComment.get(self.comment.id)
         author = user
         target = project
         return dict(r=0,
                     html=st('/widgets/issue/issue_comment.html',
                             **locals()))