Author: adrian
Date: 2006-05-25 23:21:36 -0500 (Thu, 25 May 2006)
New Revision: 2983
Modified:
django/trunk/django/contrib/comments/feeds.py
Log:
Fixed #1981 -- Fixed bug in feeds.py for comments
Modified: django/trunk/django/contrib/comments/feeds.py
===================================================================
--- django/trunk/django/contrib/comments/feeds.py 2006-05-26 04:14:41 UTC
(rev 2982)
+++ django/trunk/django/contrib/comments/feeds.py 2006-05-26 04:21:36 UTC
(rev 2983)
@@ -5,7 +5,7 @@
from django.contrib.sites.models import Site
class LatestFreeCommentsFeed(Feed):
- """Feed of latest comments on the current site"""
+ "Feed of latest comments on the current site."
comments_class = FreeComment
@@ -25,24 +25,18 @@
return "Latest comments on %s" % self._site.name
def items(self):
- return self.comments_class.objects.filter(**self._get_lookup_kwargs())
+ return self.comments_class.objects.filter(site__pk=settings.SITE_ID,
is_public=True)[:40]
- def _get_lookup_kwargs(self):
- return {
- 'site__pk': settings.SITE_ID,
- 'is_public__exact': True,
- 'limit': 40,
- }
-
class LatestCommentsFeed(LatestFreeCommentsFeed):
"""Feed of latest free comments on the current site"""
comments_class = Comment
- def _get_lookup_kwargs(self):
- kwargs = LatestFreeCommentsFeed._get_lookup_kwargs(self)
- kwargs['is_removed__exact'] = False
+ def items(self):
+ qs = LatestFreeCommentsFeed.items(self)
+ qs = qs.filter(is_removed=False)
if settings.COMMENTS_BANNED_USERS_GROUP:
- kwargs['where'] = ['user_id NOT IN (SELECT user_id FROM
auth_users_group WHERE group_id = %s)']
- kwargs['params'] = [COMMENTS_BANNED_USERS_GROUP]
- return kwargs
+ where = ['user_id NOT IN (SELECT user_id FROM auth_users_group
WHERE group_id = %s)']
+ params = [COMMENTS_BANNED_USERS_GROUP]
+ qs = qs.extra(where=where, params=params)
+ return qs
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---