X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/6b22f44c53cf0d72a7b2b068f51cae01e1129e23..7608e62fe0292a62f7181c4bdd427adee0ccdfd6:/forum/feed.py?ds=sidebyside diff --git a/forum/feed.py b/forum/feed.py index e00f33b..15a8ab9 100644 --- a/forum/feed.py +++ b/forum/feed.py @@ -5,6 +5,7 @@ except: from django.contrib.syndication.feeds import Feed, FeedDoesNotExist old_version = True +from django.http import HttpResponse from django.utils.translation import ugettext as _ from models import Question from forum import settings @@ -17,10 +18,10 @@ class RssQuestionFeed(Feed): self._title = title self._description = description self._question_list = question_list - self._url = request.path + self._url = request.path + "&" + "&".join(["%s=%s" % (k, v) for k, v in request.GET.items() if not k in ('page', 'pagesize', 'sort')]) if old_version: - super(Feed, self).__init__(request, '') + super(RssQuestionFeed, self).__init__('', request) def title(self): return self._title @@ -40,5 +41,16 @@ class RssQuestionFeed(Feed): def item_pubdate(self, item): return item.added_at + def item_categories(self, item): + return item.tagname_list() + def items(self, item): return self._question_list[:30] + + if old_version: + def __call__(self, request): + feedgen = self.get_feed('') + response = HttpResponse(mimetype=feedgen.mime_type) + feedgen.write(response, 'utf-8') + return response +