Upload a new comment.
358621
def comments(case_id):
    """"""
    text = request.form['text']
    variant_id = request.form.get('variant_id')
    username = request.form.get('username')
    case_obj = app.db.case(case_id)
    app.db.add_comment(case_obj, text, variant_id=variant_id, username=username)
    return redirect(request.referrer)
1279462
public function addComment($comment)
    {
        $comment->setPaymentId($this->getPaymentId());
        $comment->save();

        $this->load($this->getPaymentId());

        return $comment;
    }
1115918
def add(self, post_id):
        '''
        
        '''
        post_data = self.get_post_data()

        post_data['user_name'] = self.userinfo.user_name
        post_data['user_id'] = self.userinfo.uid
        post_data['post_id'] = post_id
        replyid = MReply.create_reply(post_data)
        if replyid:
            out_dic = {'pinglun': post_data['cnt_reply'],
                       'uid': replyid}
            logger.info('add reply result dic: {0}'.format(out_dic))
            return json.dump(out_dic, self)
426841
def update_invoice_comment(self, invoice_comment_id, invoice_comment_dict):
        
        return self._create_put_request(
            resource=INVOICE_COMMENTS,
            billomat_id=invoice_comment_id,
            send_data=invoice_comment_dict
        )
960257
def create_comment(self, body):
        
        assert isinstance(body, (str, unicode)), body
        post_parameters = {
            "body": body,
        }
        headers, data = self._requester.requestJsonAndCheck(
            "POST",
            self.url + "/comments",
            input=post_parameters
        )
        return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
115159
def comment(self, comment, show=False, endline=True, newpar=False):
        """"""
        if not endline:
            comment += "<NOBR>"
        if newpar:
            comment += "<BR>"
        self._write("comment:%d:%s\n" % (int(show), comment))
        return self
343448
def save(self, request):
        
        comment = self.get_comment_object()
        obj = comment.content_object
        if request.user.is_authenticated():
            comment.user = request.user
        comment.by_author = request.user == getattr(obj, "user", None)
        comment.ip_address = ip_for_request(request)
        comment.replied_to_id = self.data.get("replied_to")

        # YaCms's duplicate check that also checks `replied_to_id`.
        lookup = {
            "content_type": comment.content_type,
            "object_pk": comment.object_pk,
            "user_name": comment.user_name,
            "user_email": comment.user_email,
            "user_url": comment.user_url,
            "replied_to_id": comment.replied_to_id,
        }
        for duplicate in self.get_comment_model().objects.filter(**lookup):
            if (duplicate.submit_date.date() == comment.submit_date.date() and
                    duplicate.comment == comment.comment):
                return duplicate

        comment.save()
        comment_was_posted.send(sender=comment.__class__, comment=comment,
                                request=request)
        notify_emails = split_addresses(settings.COMMENTS_NOTIFICATION_EMAILS)
        if notify_emails:
            subject = ugettext("New comment for: ") + str(obj)
            context = {
                "comment": comment,
                "comment_url": add_cache_bypass(comment.get_absolute_url()),
                "request": request,
                "obj": obj,
            }
            send_mail_template(subject, "email/comment_notification",
                               settings.DEFAULT_FROM_EMAIL, notify_emails,
                               context)
        return comment
331108
def add_comment(self, body, allow_create=False, allow_hashes=False,
                    summary=None):
        
        thread_id = self.lookup_thread_id()
        if not allow_create and not self.redis.exists(thread_id):
            raise ValueError('Tried to add comment to non-exist thread %s' % (
                thread_id))

        comment = comments.SingleComment(
            self.user, datetime.datetime.now(datetime.timezone.utc), body, 
            summary=summary)
        lpush = self.redis.lpush(thread_id, comment.to_json())
        logging.debug('Pushing comment to redis returned %s', str(lpush))
        if self.ltrim:
            ltrim = self.redis.ltrim(thread_id, 0, self.ltrim)
            logging.debug('Redis ltrim returend %s', str(ltrim))
        else:
            ltrim = None

        return {'status': 'OK', 'lpush': lpush, 'ltrim': ltrim}
20952
def new
      respond_to do |format|
        format.html do
          render :new, locals: { comment: Comment.new, target_id: params[:id] }
        end
      end
    end
826088
def NewFromJSON(data):
        
        return Comment(
            body=data.get('body', None),
            posted_at=data.get('posted_at', None),
            user=User.NewFromJSON(data.get('user', None))
        )
840597
def create
      set_post_from_post_id
      set_comment_as_new
      comment.save
      yield comment if block_given?
      respond_to do |format|
        format.js   { create_respond_to_js }
        format.html { create_respond_to_html }
      end
    end
25857
public void postComment(int id, int rating, String comment) {
        ClientResource resource = new ClientResource(Route.ADD_COMMENT.url(id));
        resource.setChallengeResponse(this.auth.toChallenge());

        Form form = new Form();
        if (id > 0)
            form.add("rating", String.valueOf(rating));
        if (comment != null && comment.length() > 0)
            form.add("comment", comment);

        resource.post(form);
    }
781422
def create_comment(ticket_id, input, options = {})
      make_request("tickets/#{ticket_id}", ({:update => Zendesk::Main.to_xml('comment', input)}), options)
    end
1241546
def add_comment(self, line):
        
        if not isinstance(self.last_item, Comment):
            comment = Comment(self._structure)
            self._structure.append(comment)
        self.last_item.add_line(line)
        return self
466031
def createComment(self, *args, **kwargs):
        

        return self._makeApiCall(self.funcinfo["createComment"], *args, **kwargs)
1193908
public function addAction()
    {
        $isPosted = $this->request->getPost('doCreate');
        
        if (!$isPosted) {
            $this->response->redirect($this->request->getPost('redirect'));
        }

        $comment = [
            'content'   => $this->request->getPost('content'),
            'name'      => $this->request->getPost('name'),
            'web'       => $this->request->getPost('web'),
            'mail'      => $this->request->getPost('mail'),
            'timestamp' => time(),
            'ip'        => $this->request->getServer('REMOTE_ADDR'),
        ];

        $comments = new \Phpmvc\Comment\CommentsInSession();
        $comments->setDI($this->di);

        $comments->add($comment);

        $this->response->redirect($this->request->getPost('redirect'));
    }
1180763
def insert(self, thread):
        """"""
        thread_id = thread['id']
        title = thread['title']
        self.db.threads.new(thread_id, title)

        comments = list(map(self._build_comment, thread['comments']))
        comments.sort(key=lambda comment: comment['id'])
        self.count += len(comments)
        for comment in comments:
            self.db.comments.add(thread_id, comment)