+
+class RssAnswerFeed(BaseNodeFeed):
+ if old_version:
+ title_template = "feeds/rss_answer_title.html"
+
+ def __init__(self, request, question, include_comments=False):
+ super(RssAnswerFeed, self).__init__(request, _("Answers to: %s") % question.title, question.html, question.get_absolute_url())
+ self._question = question
+ self._include_comments = include_comments
+
+ def items(self):
+ if self._include_comments:
+ qs = self._question.all_children
+ else:
+ qs = self._question.answers
+
+ return qs.filter_state(deleted=False).order_by('-added_at')[:30]
+
+ def item_title(self, item):
+ if item.node_type == "answer":
+ return _("Answer by %s") % item.author.username
+ else:
+ return _("Comment by %(cauthor)s on %(pauthor)s's %(qora)s") % dict(
+ cauthor=item.author.username, pauthor=item.parent.author.username, qora=(item.parent.node_type == "answer" and _("answer") or _("question"))
+ )
+
+
+
+