Return the URL for the comment without fetching its submission.
348517
def quick_url(comment):
    """"""
    def to_id(fullname):
        return fullname.split('_', 1)[1]
    return ('http://www.reddit.com/r/{}/comments/{}/_/{}?context=3'
            .format(comment.subreddit.display_name, to_id(comment.link_id),
                    comment.id))
52631
def request_comment_show(self, request_id, id, **kwargs):
        ""
        api_path = "/api/v2/requests/{request_id}/comments/{id}.json"
        api_path = api_path.format(request_id=request_id, id=id)
        return self.call(api_path, **kwargs)
929551
def _get(self, url, params=None, headers=None):
        """"""
        url = self.clean_url(url)
        response = requests.get(url, params=params, verify=self.verify,
                                timeout=self.timeout, headers=headers)
        return response
1340120
def url(self):
        """"""
        return urllib.quote(urljoin(self.path, self.binary),
                            safe='%/:=&?~#+!$,;\'@()*[]|')
1181937
def post_comment_ajax(request, using=None):
    
    if not request.is_ajax():
        return HttpResponseBadRequest("Expecting Ajax call")

    # This is copied from django_comments.
    # Basically that view does too much, and doesn't offer a hook to change the rendering.
    # The request object is not passed to next_redirect for example.
    #
    # This is a separate view to integrate both features. Previously this used django-ajaxcomments
    # which is unfortunately not thread-safe (it it changes the comment view per request).

    # Fill out some initial data fields from an authenticated user, if present
    data = request.POST.copy()
    if request.user.is_authenticated:
        if not data.get('name', ''):
            data["name"] = request.user.get_full_name() or request.user.username
        if not data.get('email', ''):
            data["email"] = request.user.email

    # 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 = apps.get_model(*ctype.split(".", 1))
        target = model._default_manager.using(using).get(pk=object_pk)
    except ValueError:
        return CommentPostBadRequest("Invalid object_pk value: {0}".format(escape(object_pk)))
    except (TypeError, LookupError):
        return CommentPostBadRequest("Invalid content_type value: {0}".format(escape(ctype)))
    except AttributeError:
        return CommentPostBadRequest("The given content-type {0} does not resolve to a valid model.".format(escape(ctype)))
    except ObjectDoesNotExist:
        return CommentPostBadRequest("No object matching content-type {0} and object PK {1} exists.".format(escape(ctype), escape(object_pk)))
    except (ValueError, ValidationError) as e:
        return CommentPostBadRequest("Attempting go get content-type {0!r} and object PK {1!r} exists raised {2}".format(escape(ctype), escape(object_pk), e.__class__.__name__))

    # Do we want to preview the comment?
    is_preview = "preview" in data

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

    # Check security information
    if form.security_errors():
        return CommentPostBadRequest("The comment form failed security verification: {0}".format(form.security_errors()))

    # If there are errors or if we requested a preview show the comment
    if is_preview:
        comment = form.get_comment_object() if not form.errors else None
        return _ajax_result(request, form, "preview", comment, object_id=object_pk)
    if form.errors:
        return _ajax_result(request, form, "post", object_id=object_pk)

    # 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 is False:
            return CommentPostBadRequest("comment_will_be_posted receiver {0} killed the comment".format(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
    )

    return _ajax_result(request, form, "post", comment, object_id=object_pk)
99751
def request_comments(self, id, **kwargs):
        ""
        api_path = "/api/v2/requests/{id}/comments.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
360747
def comments(self, limit=None):
        
        return self._reddit._limit_get(self.permalink, limit=limit)[1]
1087286
def fetch_data(self, url):
        ''' 
        
        '''
        return self.http._post_data(url, None, self.http._headers_with_access_token())
640244
def unshorten_url(short_url):
    """"""
    short_url = short_url.strip()
    if not short_url.startswith('http'):
        short_url = 'http://{0}'.format(short_url)

    try:
        cached_url = UnshortenURL.objects.get(short_url=short_url)
    except UnshortenURL.DoesNotExist:
        cached_url = UnshortenURL(short_url=short_url)
    else:
        return cached_url.long_url

    try:
        resp = urllib2.urlopen(short_url)
    except (
            urllib2.HTTPError, urllib2.URLError,
            httplib.HTTPException):
        return None

    if resp.code == 200:
        cached_url.long_url = resp.url
        cached_url.save()
        return resp.url
556591
function stripComments(token) {
  return strip

  /* Strip comments. */
  function strip(value) {
    var index = value.indexOf(token)

    if (index !== -1) {
      value = value.substr(0, index)
    }

    return value
  }
}
509075
def get_as_text(self):
        
        d = {
            'user': self.user or self.name,
            'date': self.submit_date,
            'comment': self.comment,
            'domain': self.site.domain,
            'url': self.get_absolute_url()
        }
        return _('Posted by %(user)s at %(date)s\n\n%(comment)s\n\nhttp://%(domain)s%(url)s') % d
1081425
public static String getComment(String comment)
	{
		StringBuffer _result = new StringBuffer();
		return doAppendComment(_result, comment).toString();
	}
614423
def get_short_url(self, obj):
        
        try:
            url = obj.get_absolute_url()
        except NoReverseMatch:
            url = '/blog/' + obj.slug
        return url
699037
def get_thread_by_url(url)
      response = Disqus::Api::get_thread_by_url(:url => url, :forum_api_key => key)
      if response["succeeded"]
        t = response["message"]
        Thread.new(t["id"], self, t["slug"], t["title"], t["created_at"], t["allow_comments"], t["url"], t["identifier"])
      else
        raise_api_error(response)
      end
    end
482748
def url(self):
        """"""
        if not self._url[2].endswith('/'):
            self._url[2] += '/'
        return RestURL.url.__get__(self)
385309
def delete_comment(self, comment_id):
        """"""

        comment_obj = self.query(Comment).get(comment_id)
        if comment_obj:
            logger.debug("Deleting comment {0}".format(comment_obj.id))

        self.session.delete(comment_obj)
        self.save()

        return comment_obj
466759
def _compress_url(link):
        
        comment_re = re.compile(r'/comments/([A-Za-z\d]{2,})(?:/[^\s]+/([A-Za-z\d]+))?')
        message_re = re.compile(r'/message/messages/([A-Za-z\d]+)')
        matches = re.findall(comment_re, link)

        if len(matches) == 0:
            matches = re.findall(message_re, link)

            if len(matches) == 0:
                return None
            else:
                return 'm,' + matches[0]
        else:
            if matches[0][1] == '':
                return 'l,' + matches[0][0]
            else:
                return 'l,' + matches[0][0] + ',' + matches[0][1]