Esempio n. 1
0
def RssSoftwareAndCommentsFeed(request, software_id):
    sw = get_object_or_404(Software, pk=software_id)
    ctype = ContentType.objects.get_for_model(sw)
    object_list = Comment.objects.filter(content_type=ctype, object_pk=sw.pk).order_by('submit_date')

    feed = WellFormedWebRss( u'mloss.org ' + sw.title.encode('utf-8'),
            "http://mloss.org",
            u'Updates and additions to ' + sw.title.encode('utf-8'),
            language=u"en")

    rev = get_object_or_404(Revision, software=sw, revision=0)
    link = 'http://%s%s' % (Site.objects.get_current().domain, sw.get_absolute_url())
    commentlink=u'http://%s/software/rss/comments/%i' % (Site.objects.get_current().domain, sw.id)
    feed.add_item( sw.title.encode('utf-8') + u' ' + rev.version.encode('utf-8'),
        link, rev.get_description_page(),
        author_name=rev.authors.encode('utf-8'),
        comments=commentlink,
        pubdate=rev.updated_date, unique_id=link,
        categories=[x.name for x in rev.get_taglist()] )

    for object in object_list:
        link = 'http://%s%s' % (Site.objects.get_current().domain, object.get_absolute_url())
        feed.add_item(u'<b>Comment by %s on %s</b>' % (object.name, object.submit_date.strftime("%Y-%m-%d %H:%M")),
                link, markdown(object.comment),
                author_name=object.name,
                pubdate=object.submit_date, unique_id=link,)
    response = HttpResponse(mimetype='application/xml')
    feed.write(response, 'utf-8')
    return response
Esempio n. 2
0
def RssCommentsFeed(request, software_id):
    sw = get_object_or_404(Software, pk=software_id)
    ctype = ContentType.objects.get_for_model(sw)
    object_list = Comment.objects.filter(content_type=ctype, object_pk=sw.pk).order_by('submit_date')

    feed = WellFormedWebRss( u'mloss.org ' + sw.title.encode('utf-8'),
            "http://mloss.org",
            u'Updates and additions to ' + sw.title.encode('utf-8'),
            language=u"en")

    for object in object_list:
        link = 'http://%s%s' % (Site.objects.get_current().domain, object.get_absolute_url())
        feed.add_item(u'<b>By: %s on: %s</b>' % (object.name, object.submit_date.strftime("%Y-%m-%d %H:%M")),
                link, markdown(object.comment),
                author_name=object.name,
                pubdate=object.submit_date, unique_id=link,)
    response = HttpResponse(mimetype='application/xml')
    feed.write(response, 'utf-8')
    return response
Esempio n. 3
0
def RssCommentsFeed(request, software_id):
    sw = get_object_or_404(Software, pk=software_id)
    ctype = ContentType.objects.get_for_model(sw)
    object_list = Comment.objects.filter(
        content_type=ctype, object_pk=sw.pk).order_by('submit_date')

    feed = WellFormedWebRss(u'mloss.org ' + sw.title.encode('utf-8'),
                            "http://mloss.org",
                            u'Updates and additions to ' +
                            sw.title.encode('utf-8'),
                            language=u"en")

    for object in object_list:
        link = 'http://%s%s' % (Site.objects.get_current().domain,
                                object.get_absolute_url())
        feed.add_item(
            u'<b>By: %s on: %s</b>' %
            (object.name, object.submit_date.strftime("%Y-%m-%d %H:%M")),
            link,
            markdown(object.comment),
            author_name=object.name,
            pubdate=object.submit_date,
            unique_id=link,
        )
    response = HttpResponse(mimetype='application/xml')
    feed.write(response, 'utf-8')
    return response
Esempio n. 4
0
def RssSoftwareFeed(request):
    try:
        object_list = Revision.objects.filter(
            revision=0).order_by('-updated_date')[:10]
    except documents.DocumentDoesNotExist:
        raise Http404
    feed = WellFormedWebRss(u"mloss.org new software",
                            "http://mloss.org",
                            u'Updates and additions to mloss.org',
                            language=u"en")

    for object in object_list:
        link = 'http://%s%s' % (Site.objects.get_current().domain,
                                object.get_absolute_url())
        commentlink = u'http://%s/software/rss/comments/%i' % (
            Site.objects.get_current().domain, object.id)
        feed.add_item(object.software.title.encode('utf-8') + u' ' +
                      object.version.encode('utf-8'),
                      link,
                      object.get_description_page(),
                      author_name=object.authors.encode('utf-8'),
                      comments=commentlink,
                      pubdate=object.updated_date,
                      unique_id=link,
                      categories=[x.name for x in object.get_taglist()])
    response = HttpResponse(mimetype='application/xml')
    feed.write(response, 'utf-8')
    return response
Esempio n. 5
0
def RssSoftwareFeed(request):
    try:
        object_list = Revision.objects.filter(revision=0).order_by('-updated_date')[:10]
    except documents.DocumentDoesNotExist:
        raise Http404
    feed = WellFormedWebRss( u"mloss.org new software",
            "http://mloss.org",
            u'Updates and additions to mloss.org',
            language=u"en")

    for object in object_list:
        link = 'http://%s%s' % (Site.objects.get_current().domain, object.get_absolute_url())
        commentlink=u'http://%s/software/rss/comments/%i' % (Site.objects.get_current().domain, object.id)
        feed.add_item( object.software.title.encode('utf-8') + u' ' + object.version.encode('utf-8'),
                link, object.get_description_page(),
                author_name=object.authors.encode('utf-8'),
                comments=commentlink,
                pubdate=object.updated_date, unique_id=link,
                categories=[x.name for x in object.get_taglist()] )
    response = HttpResponse(mimetype='application/xml')
    feed.write(response, 'utf-8')
    return response
Esempio n. 6
0
def RssSoftwareAndCommentsFeed(request, software_id):
    sw = get_object_or_404(Software, pk=software_id)
    ctype = ContentType.objects.get_for_model(sw)
    object_list = Comment.objects.filter(
        content_type=ctype, object_pk=sw.pk).order_by('submit_date')

    feed = WellFormedWebRss(u'mloss.org ' + sw.title.encode('utf-8'),
                            "http://mloss.org",
                            u'Updates and additions to ' +
                            sw.title.encode('utf-8'),
                            language=u"en")

    rev = get_object_or_404(Revision, software=sw, revision=0)
    link = 'http://%s%s' % (Site.objects.get_current().domain,
                            sw.get_absolute_url())
    commentlink = u'http://%s/software/rss/comments/%i' % (
        Site.objects.get_current().domain, sw.id)
    feed.add_item(sw.title.encode('utf-8') + u' ' +
                  rev.version.encode('utf-8'),
                  link,
                  rev.get_description_page(),
                  author_name=rev.authors.encode('utf-8'),
                  comments=commentlink,
                  pubdate=rev.updated_date,
                  unique_id=link,
                  categories=[x.name for x in rev.get_taglist()])

    for object in object_list:
        link = 'http://%s%s' % (Site.objects.get_current().domain,
                                object.get_absolute_url())
        feed.add_item(
            u'<b>Comment by %s on %s</b>' %
            (object.name, object.submit_date.strftime("%Y-%m-%d %H:%M")),
            link,
            markdown(object.comment),
            author_name=object.name,
            pubdate=object.submit_date,
            unique_id=link,
        )
    response = HttpResponse(mimetype='application/xml')
    feed.write(response, 'utf-8')
    return response
Esempio n. 7
0
def ForumFeed(request, forum):
    f = get_object_or_404(Forum, slug=forum)
    try:
        object_list = f.thread_set.all()
    except documents.DocumentDoesNotExist:
        raise Http404
    feed = WellFormedWebRss( u"mloss.org community forum %s" % f.title.encode('utf-8'),
            "http://mloss.org",
            u'Updates to mloss.org forum %s' % f.title.encode('utf-8'),
            language=u"en")

    for thread in object_list:
        link = u'http://%s%s' % (Site.objects.get_current().domain, thread.get_absolute_url())
        commentlink=u'http://%s%s' % (Site.objects.get_current().domain, thread.get_absolute_url())
        commentrss=u'http://%s/community/rss/thread/%i' % (Site.objects.get_current().domain, thread.id)
        feed.add_item( thread.title.encode('utf-8'),
                commentlink, None,
                comments=commentlink,
                pubdate=thread.thread_latest_post.time, unique_id=link)
        feed.add_commentRss(commentrss)

    response = HttpResponse(mimetype='application/xml')
    feed.write(response, 'utf-8')
    return response
Esempio n. 8
0
def ThreadFeed(request, forum, thread):
    thread = get_object_or_404(Thread, pk=thread)

    feed = WellFormedWebRss( u"mloss.org community forum",
            "http://mloss.org",
            u'Updates to mloss.org thread %s' % thread.title.encode('utf-8'),
            language=u"en")

    for post in thread.post_set.all().order_by('time'):
            link = u'http://%s%s' % (Site.objects.get_current().domain, post.get_absolute_url())
            feed.add_item(u'<b>By: %s on: %s</b>' % (post.author.username, post.time.strftime("%Y-%m-%d %H:%M")),
                    link, markdown(post.body), 
                    author_name=post.author.username,
                    pubdate=post.time, unique_id=link)

    response = HttpResponse(mimetype='application/xml')
    feed.write(response, 'utf-8')
    return response
Esempio n. 9
0
def RssBlogFeed(request):
    try:
        object_list = BlogItem.objects.all().order_by('-pub_date')[:10]
    except documents.DocumentDoesNotExist:
        raise Http404
    feed = WellFormedWebRss( u"The mloss.org community blog",
            "http://mloss.org/community",
            u'Some thoughts about machine learning open source software',
            language=u"en")

    for object in object_list:
        link = 'http://%s%s' % (Site.objects.get_current().domain, object.get_absolute_url())
        #commentlink=u'http://%s/software/rss/comments/%i' % (Site.objects.get_current().domain, object.id)
        #comments=commentlink,
        feed.add_item( object.headline.encode('utf-8'),
                link, markdown(object.body),
                author_name=object.author.encode('utf-8'),
                pubdate=object.pub_date, unique_id=link)
    response = HttpResponse(mimetype='application/xml')
    feed.write(response, 'utf-8')
    return response