def __create_comments(self): self.comment_1 = Comment() self.comment_1.owner = self.user_mnieber self.comment_1.body = "Thanks for the feedback" self.comment_1.review = self.review_yoga_twist self.comment_1.is_draft = False self.comment_1.save() self.comment_2 = Comment() self.comment_2.owner = self.user_anders_om self.comment_2.body = "I see your point" self.comment_2.review = self.review_yoga_twist self.comment_2.reply_to = self.comment_1 self.comment_2.is_draft = False self.comment_2.save()
def __get_or_create_comment( self, global_user, review, reply_to_comment_id ): draft = review.comments.filter( is_draft=True, owner=global_user, review_id=review.id, reply_to_id=reply_to_comment_id ).first() if not draft: draft = Comment() draft.owner = global_user draft.review = review draft.reply_to_id = reply_to_comment_id draft.save() return draft
def generate_comments(chunk, checkstyle_user, batch): xml = run_checkstyle(chunk.file.path) comment_nodes = find_comment_nodes(xml) ignored = 0 comments = [] for node in comment_nodes: if node.getAttribute('source') in ignored_warnings[chunk.class_type]: ignored += 1 else: comments.append( Comment(type='S', text=node.getAttribute('message'), chunk=chunk, batch=batch, author=checkstyle_user, start=node.getAttribute('line'), end=node.getAttribute('line'))) print "checkstyle: on", chunk.name, 'I made', len( comments), 'comments and ignored', ignored, 'minor problems' return comments
def generate_comments(chunk, checkstyle_user, batch, suppress_comment_regexes): xml = run_checkstyle(chunk.file.path) comment_nodes = find_comment_nodes(xml) ignored = 0 comments = [] for node in comment_nodes: message = node.getAttribute('message') line = node.getAttribute('line') checkstyleModule = node.getAttribute('source') if checkstyleModule in ignored_warnings[chunk.class_type] or matchesAny(suppress_comment_regexes, chunk.file.path + ':' + message): ignored += 1 else: comments.append(Comment( type='S', text=message, chunk=chunk, batch=batch, author=checkstyle_user, start=line, end=line)) print "checkstyle: on", chunk.name, 'I made', len(comments), 'comments and ignored', ignored, 'minor problems' return comments
def add(request): name = request.POST['name'] comment = request.POST['comment'] Comment(name=name, comment=comment).save() return HttpResponseRedirect('/review/insert')