summaryrefslogtreecommitdiffstats
path: root/askbot/feed.py
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-11-10 18:22:48 -0300
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-11-10 18:22:48 -0300
commit4ce19e152c1244a6acf74c9ce3622493adc49947 (patch)
tree2c03542e8850187003f96e6fe24b67729ce68287 /askbot/feed.py
parent1c8312e5faef62774172b1d68d43128757752d58 (diff)
parente5cd06565aba57e64e8f2e5c622b211c0bb23be4 (diff)
downloadaskbot-4ce19e152c1244a6acf74c9ce3622493adc49947.tar.gz
askbot-4ce19e152c1244a6acf74c9ce3622493adc49947.tar.bz2
askbot-4ce19e152c1244a6acf74c9ce3622493adc49947.zip
merged the django1.4 compatibility branch by Adolfo
Diffstat (limited to 'askbot/feed.py')
-rw-r--r--askbot/feed.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/askbot/feed.py b/askbot/feed.py
index ac3dcdd0..0e1102b1 100644
--- a/askbot/feed.py
+++ b/askbot/feed.py
@@ -12,9 +12,10 @@
"""
#!/usr/bin/env python
#encoding:utf-8
+from django.contrib.syndication.views import Feed
+
import itertools
-from django.contrib.syndication.feeds import Feed
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext as _
from django.core.exceptions import ObjectDoesNotExist
@@ -37,12 +38,12 @@ class RssIndividualQuestionFeed(Feed):
def description(self):
return askbot_settings.APP_DESCRIPTION
- def get_object(self, bits):
+ def get_object(self, request, pk):
if askbot_settings.RSS_ENABLED is False:
raise Http404
- if len(bits) != 1:
- raise ObjectDoesNotExist
- return Post.objects.get_questions().get(id__exact = bits[0])
+ #hack to get the request object into the Feed class
+ self.request = request
+ return Post.objects.get_questions().get(id__exact = pk)
def item_link(self, item):
"""get full url to the item
@@ -70,6 +71,7 @@ class RssIndividualQuestionFeed(Feed):
)
answers = Post.objects.get_answers().filter(thread = item.thread)
+
for answer in answers:
chain_elements.append([answer,])
chain_elements.append(
@@ -137,7 +139,7 @@ class RssLastestQuestionsFeed(Feed):
"""returns url without the slug
because the slug can change
"""
- return askbot_settings.APP_URL + item.get_absolute_url(no_slug = True)
+ return self.link() + item.get_absolute_url(no_slug = True)
def item_description(self, item):
"""returns the description for the item
@@ -169,6 +171,10 @@ class RssLastestQuestionsFeed(Feed):
return qs.order_by('-thread__last_activity_at')[:30]
+ #hack to get the request object into the Feed class
+ def get_feed(self, obj, request):
+ self.request = request
+ return super(RssLastestQuestionsFeed, self).get_feed(obj, request)
def main():
"""main function for use as a script