]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/feed.py
OSQA-349
[osqa.git] / forum / feed.py
index e00f33b923f3c1eff83420d81a228c96ee14fa1c..15a8ab9da366e97e7ae307e198dfe146ecc92268 100644 (file)
@@ -5,6 +5,7 @@ except:
     from django.contrib.syndication.feeds import Feed, FeedDoesNotExist
     old_version = True
 
     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
 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._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:
 
         if old_version:
-            super(Feed, self).__init__(request, '')
+            super(RssQuestionFeed, self).__init__('', request)
 
     def title(self):
         return self._title
 
     def title(self):
         return self._title
@@ -40,5 +41,16 @@ class RssQuestionFeed(Feed):
     def item_pubdate(self, item):
         return item.added_at
 
     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]
     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
+