summaryrefslogtreecommitdiffstats
path: root/askbot/feed.py
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2012-10-10 15:12:04 -0600
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2012-10-10 15:48:35 -0600
commit7658b6725d32488506f28e4867577516f2e4455f (patch)
tree4a9cd2e28ae7446820d4954d0f72b7adadc61197 /askbot/feed.py
parent1f90a80a86690aa70b18e8770f55afb88838a8ae (diff)
downloadaskbot-7658b6725d32488506f28e4867577516f2e4455f.tar.gz
askbot-7658b6725d32488506f28e4867577516f2e4455f.tar.bz2
askbot-7658b6725d32488506f28e4867577516f2e4455f.zip
Fixed issue with feed, changed settings.py template, fixed issue with
skin loader, fixed urls.py for feeds fixed bug in messages hack with django 1.4.1 all test pass in 1.3.1, haystack and email parsing tests fails on 1.4.1
Diffstat (limited to 'askbot/feed.py')
-rw-r--r--askbot/feed.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/askbot/feed.py b/askbot/feed.py
index 9652da6d..96cd8436 100644
--- a/askbot/feed.py
+++ b/askbot/feed.py
@@ -12,10 +12,7 @@
"""
#!/usr/bin/env python
#encoding:utf-8
-try:
- from django.contrib.syndication.feeds import Feed
-except ImportError:
- from django.contrib.syndication.views import Feed
+from django.contrib.syndication.views import Feed
import itertools
@@ -40,10 +37,10 @@ class RssIndividualQuestionFeed(Feed):
def description(self):
return askbot_settings.APP_DESCRIPTION
- def get_object(self, bits):
- if len(bits) != 1:
- raise ObjectDoesNotExist
- return Post.objects.get_questions().get(id__exact = bits[0])
+ def get_object(self, request, pk):
+ #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
@@ -139,7 +136,7 @@ class RssLastestQuestionsFeed(Feed):
"""returns url without the slug
because the slug can change
"""
- return self.link + 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 +166,11 @@ 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
"""