summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askbot/feed.py59
-rw-r--r--askbot/skins/default/templates/main_page/tab_bar.html4
2 files changed, 40 insertions, 23 deletions
diff --git a/askbot/feed.py b/askbot/feed.py
index c1933afe..776aad5e 100644
--- a/askbot/feed.py
+++ b/askbot/feed.py
@@ -25,20 +25,29 @@ from askbot.conf import settings as askbot_settings
class RssIndividualQuestionFeed(Feed):
"""rss feed class for particular questions
"""
- title = askbot_settings.APP_TITLE + _(' - ')+ _('Individual question feed')
- link = askbot_settings.APP_URL
- description = askbot_settings.APP_DESCRIPTION
- copyright = askbot_settings.APP_COPYRIGHT
+
+ def title(self):
+ return askbot_settings.APP_TITLE + _(' - ') + \
+ _('Individual question feed')
+
+ def feed_copyright(self):
+ return askbot_settings.APP_COPYRIGHT
+
+ 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 item_link(self, item):
"""get full url to the item
"""
- return self.link + item.get_absolute_url()
+ return askbot_settings.APP_URL + item.get_absolute_url()
+
+ def link(self):
+ return askbot_settings.APP_URL
def item_pubdate(self, item):
"""get date of creation for the item
@@ -56,7 +65,7 @@ class RssIndividualQuestionFeed(Feed):
chain_elements.append(
Post.objects.get_comments().filter(parent=item)
)
-
+
answers = Post.objects.get_answers().filter(thread = item.thread)
for answer in answers:
chain_elements.append([answer,])
@@ -65,7 +74,7 @@ class RssIndividualQuestionFeed(Feed):
)
return itertools.chain(*chain_elements)
-
+
def item_title(self, item):
"""returns the title for the item
"""
@@ -77,7 +86,7 @@ class RssIndividualQuestionFeed(Feed):
elif item.post_type == "comment":
title = "Comment by %s for %s" % (item.author, self.title)
return title
-
+
def item_description(self, item):
"""returns the description for the item
"""
@@ -87,16 +96,24 @@ class RssIndividualQuestionFeed(Feed):
class RssLastestQuestionsFeed(Feed):
"""rss feed class for the latest questions
"""
- title = askbot_settings.APP_TITLE + _(' - ')+ _('latest questions')
- link = askbot_settings.APP_URL
- description = askbot_settings.APP_DESCRIPTION
- #ttl = 10
- copyright = askbot_settings.APP_COPYRIGHT
+
+ def title(self):
+ return askbot_settings.APP_TITLE + _(' - ') + \
+ _('Individual question feed')
+
+ def feed_copyright(self):
+ return askbot_settings.APP_COPYRIGHT
+
+ def description(self):
+ return askbot_settings.APP_DESCRIPTION
def item_link(self, item):
"""get full url to the item
"""
- return self.link + item.get_absolute_url()
+ return askbot_settings.APP_URL + item.get_absolute_url()
+
+ def link(self):
+ return askbot_settings.APP_URL
def item_author_name(self, item):
"""get name of author
@@ -117,10 +134,10 @@ class RssLastestQuestionsFeed(Feed):
"""returns url without the slug
because the slug can change
"""
- return self.link + item.get_absolute_url(no_slug = True)
-
+ return askbot_settings.APP_URL + item.get_absolute_url(no_slug = True)
+
def item_description(self, item):
- """returns the desciption for the item
+ """returns the description for the item
"""
return item.text
@@ -142,12 +159,12 @@ class RssLastestQuestionsFeed(Feed):
if tags:
#if there are tags in GET, filter the
#questions additionally
- for tag in tags:
+ for tag in tags:
qs = qs.filter(thread__tags__name = tag)
-
+
return qs.order_by('-thread__last_activity_at')[:30]
-
+
def main():
"""main function for use as a script
diff --git a/askbot/skins/default/templates/main_page/tab_bar.html b/askbot/skins/default/templates/main_page/tab_bar.html
index e08232bb..3ed59f6e 100644
--- a/askbot/skins/default/templates/main_page/tab_bar.html
+++ b/askbot/skins/default/templates/main_page/tab_bar.html
@@ -3,9 +3,9 @@
{% cache 0 "scope_sort_tabs" search_tags request.user scope sort query context.page language_code %}
<a class="rss"
{% if feed_url %}
- href="{{settings.APP_URL}}{{feed_url}}"
+ href="{{feed_url}}"
{% else %}
- href="{{settings.APP_URL}}/feeds/rss/"
+ href="/feeds/rss/"
{% endif %}
title="{% trans %}subscribe to the questions feed{% endtrans %}"
>{% trans %}RSS{% endtrans %}