Code

Ticket #5766: comments-cleanup-r6522.diff

File comments-cleanup-r6522.diff, 1005 bytes (added by Ludvig Ericson <ludvig.ericson@…>, 7 years ago)
Line 
1Index: django/contrib/comments/feeds.py
2===================================================================
3--- django/contrib/comments/feeds.py    (revision 6522)
4+++ django/contrib/comments/feeds.py    (working copy)
5@@ -4,9 +4,10 @@
6 from django.contrib.sites.models import Site
7 
8 class LatestFreeCommentsFeed(Feed):
9-    "Feed of latest comments on the current site."
10+    """Feed of latest free comments on the current site."""
11 
12     comments_class = FreeComment
13+    comment_count_limit = 40
14 
15     def title(self):
16         if not hasattr(self, '_site'):
17@@ -27,10 +28,10 @@
18         return self.comments_class.objects.filter(site__pk=settings.SITE_ID, is_public=True)
19 
20     def items(self):
21-        return self.get_query_set()[:40]
22+        return self.get_query_set()[:self.comment_count_limit]
23 
24 class LatestCommentsFeed(LatestFreeCommentsFeed):
25-    """Feed of latest free comments on the current site"""
26+    """Feed of latest comments on the current site."""
27 
28     comments_class = Comment
29