:allowed_param: 'commentId'
432149
def delete_comment(self, *args, **kwargs):
        
        return bind_api(
            api=self,
            path='/comments/{commentId}/delete',
            method='DELETE',
            payload_type='comment',
            allowed_param=['commentId']
        )(*args, **kwargs)
1183216
def ticket_comments(self, ticket_id, **kwargs):
        ""
        api_path = "/api/v2/tickets/{ticket_id}/comments.json"
        api_path = api_path.format(ticket_id=ticket_id)
        return self.call(api_path, **kwargs)
920140
def create_request_comment(self, issue_id_or_key, body, public=True):
        
        log.warning('Creating comment...')
        data = {"body": body, "public": public}

        return self.post('rest/servicedeskapi/request/{}/comment'.format(issue_id_or_key), data=data)
40947
def _invalid(m, comment=INVALID_RESPONSE, out=None):
    '''
    
    '''
    return _set_status(m, status=False, comment=comment, out=out)
755279
def get_comment(self, item):
        
        key = item.upper()
        if key not in self._record_map:
            raise KeyError("unknown record: %s" % key)

        if 'comment' not in self._record_map[key]:
            return None
        else:
            return self._record_map[key]['comment']
819553
def allowed(self, method, _dict, allow):
        
        for key in _dict.keys():
            if key not in allow:
                raise LunrError("'%s' is not an argument for method '%s'"
                                % (key, method))
32343
def update
      if @comment.update(params.permit(:content))
        render json: @comment
      else
        render json: @comment.errors, status: 422
      end
    end
1082833
def ensure_valid_role_for_commentable
      allowed_roles = commentable.class.commentable_options[:roles]

      if allowed_roles.any?
        errors.add(:role, :invalid) unless allowed_roles.include?(self.role)
      else
        errors.add(:role, :invalid) unless self.role.blank?
      end
    end
483955
def moderate(self, comment, entry, request):
        
        if self.auto_moderate_comments:
            return True

        if check_is_spam(comment, entry, request,
                         self.spam_checker_backends):
            return True

        return False
1206046
def comment(opts)
      opts = opts.merge(:sale_id => self.sale_id)
      Twocheckout::API.request(:post, 'sales/create_comment', opts)
    end
935174
def delete_comment(self, resource_id, ent_id):
        
        self.requester.post(
            '/{endpoint}/{entity}/{id}/delete_comment?id={ent_id}',
            endpoint=self.endpoint, entity=self.entity,
            id=resource_id, ent_id=ent_id
        )
1144271
def post_comment(request, next=None, using=None):
    
    # Fill out some initial data fields from an authenticated user, if present
    data = request.POST.copy()
    if request.user.is_authenticated:
        data["user"] = request.user
    else:
        return CommentPostBadRequest("You must be logged in to comment")

    # Look up the object we're trying to comment about
    ctype = data.get("content_type")
    object_pk = data.get("object_pk")
    if ctype is None or object_pk is None:
        return CommentPostBadRequest("Missing content_type or object_pk field.")
    try:
        model = models.get_model(*ctype.split(".", 1))
        target = model._default_manager.using(using).get(pk=object_pk)
    except TypeError:
        return CommentPostBadRequest(
            "Invalid content_type value: %r" % escape(ctype))
    except AttributeError:
        return CommentPostBadRequest(
            "The given content-type %r does not resolve to a valid model." % \
                escape(ctype))
    except ObjectDoesNotExist:
        return CommentPostBadRequest(
            "No object matching content-type %r and object PK %r exists." % \
                (escape(ctype), escape(object_pk)))
    except (ValueError, ValidationError) as e:
        return CommentPostBadRequest(
            "Attempting go get content-type %r and object PK %r exists raised %s" % \
                (escape(ctype), escape(object_pk), e.__class__.__name__))

    # Construct the comment form
    form = comments.get_form()(target, data=data)

    # Check security information
    if form.security_errors():
        return CommentPostBadRequest(
            "The comment form failed security verification: %s" % \
                escape(str(form.security_errors())))

    # Check for next
    if not next:
        next = data.get("next")

    # If there are errors show the comment
    if form.errors:
        template_list = [
            "comments/%s/%s/form.html" % (model._meta.app_label, model._meta.module_name),
            "comments/%s/form.html" % model._meta.app_label,
            "comments/form.html",
        ]
        return render_to_response(
            template_list, {
                "comment": form.data.get("comment", ""),
                "form": form,
                "next": data.get("next", next),
            },
            RequestContext(request, {})
        )

    # Otherwise create the comment
    comment = form.get_comment_object()
    comment.ip_address = request.META.get("REMOTE_ADDR", None)
    if request.user.is_authenticated:
        comment.user = request.user

    # Signal that the comment is about to be saved
    responses = signals.comment_will_be_posted.send(
        sender=comment.__class__,
        comment=comment,
        request=request
    )

    for (receiver, response) in responses:
        if response == False:
            return CommentPostBadRequest(
                "comment_will_be_posted receiver %r killed the comment" % receiver.__name__)

    # Save the comment and signal that it was saved
    comment.save()
    signals.comment_was_posted.send(
        sender=comment.__class__,
        comment=comment,
        request=request
    )
    messages.success(request, 'Your comment was saved.')
    return redirect(next)
1365708
def add_comment(self, page_id, text):
        
        data = {'type': 'comment',
                'container': {'id': page_id, 'type': 'page', 'status': 'current'},
                'body': {'storage': {'value': text, 'representation': 'storage'}}}
        return self.post('rest/api/content/', data=data)
91792
def handle(self, *args, **options):
        
        comments = Comment.objects.filter(
            Q(classifiedcomment__isnull=True) |
            Q(classifiedcomment__cls='unsure')).order_by('?')
        if options['count']:
            comments = comments[:options['count']]
        comment_count = comments.count()

        self.stdout.write('Classifying %s comments, please wait...' %
                          comment_count)
        self.stdout.flush()

        for comment in comments:
            classified_comment = utils.classify_comment(comment)
            self.stdout.write('%s,' % classified_comment.cls[0])
            self.stdout.flush()

        self.stdout.write('\nDone!\n')
1297744
def addComment(self, comment):
        
        url = "%s/addComment" % self.root
        params = {
            "f" : "json",
            "comment" : comment
        }
        return self._post(url, params, proxy_port=self._proxy_port,
                             securityHandler=self._securityHandler,
                             proxy_url=self._proxy_url)
395838
def obtain_comment_time(comment_id = nil, format = "%H:%M:%S")
      return nil if comment_id.blank?
      comment = Comment.find_by_id(comment_id)
      comment = comment.submitted_on.strftime(format) if !comment.blank?
      comment if !comment.blank?
    end
528714
def comment_issue(self, issue_id, body):
        
        request_url = "{}issue/{}/comment".format(self.create_basic_url(),
                                                  issue_id)

        payload = {'comment': body}

        return_value = self._call_api(request_url,
                                      method='POST', data=payload)

        LOG.debug(return_value)