On 7/2/07, JHeasly <[EMAIL PROTECTED]> wrote: > Sorry, I didn't mean to convey that ... userflags.flag() refers to > UserFlagManager directly.
Ah, ok. Yeah, this has been broken a long while. The comments contrib needs some love, but I understand Jacob's working on a rewrite, hence the lack of bug fixes in the interim. But you're in luck; I recently ported from an old version of Django to 0.96, so I had the fun of sorting through the bugs. I've filed a couple comment-related patches on tickets, but I'll attach a single diff here for convenience. You may also be interested in James' recent comment utilities: http://www.b-list.org/weblog/2007/06/25/hacking-comments-without-hacking-comments --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---
Index: django/contrib/comments/models.py =================================================================== --- django/contrib/comments/models.py (.../branches/to-dj-trunk/vendor/django_dist/django/contrib/comments) (revision 1014) +++ django/contrib/comments/models.py (.../trunk/vendor/django_dist/django/contrib/comments) (revision 1057) @@ -257,7 +257,7 @@ if int(comment.user_id) == int(user.id): return # A user can't flag his own comment. Fail silently. try: - f = self.objects.get(user__pk=user.id, comment__pk=comment.id) + f = self.get(user__pk=user.id, comment__pk=comment.id) except self.model.DoesNotExist: from django.core.mail import mail_managers f = self.model(None, user.id, comment.id, None) Index: django/contrib/comments/feeds.py =================================================================== --- django/contrib/comments/feeds.py (.../branches/to-dj-trunk/vendor/django_dist/django/contrib/comments) (revision 1014) +++ django/contrib/comments/feeds.py (.../trunk/vendor/django_dist/django/contrib/comments) (revision 1057) @@ -23,8 +23,11 @@ self._site = Site.objects.get_current() return "Latest comments on %s" % self._site.name + def _items(self): + return self.comments_class.objects.filter(site__pk=settings.SITE_ID, is_public=True) + def items(self): - return self.comments_class.objects.filter(site__pk=settings.SITE_ID, is_public=True)[:40] + return self.items()[:40] class LatestCommentsFeed(LatestFreeCommentsFeed): """Feed of latest free comments on the current site""" @@ -32,10 +35,10 @@ comments_class = Comment def items(self): - qs = LatestFreeCommentsFeed.items(self) + qs = LatestFreeCommentsFeed._items(self) qs = qs.filter(is_removed=False) if settings.COMMENTS_BANNED_USERS_GROUP: - where = ['user_id NOT IN (SELECT user_id FROM auth_users_group WHERE group_id = %s)'] + where = ['user_id NOT IN (SELECT user_id FROM auth_user_groups WHERE group_id = %s)'] params = [settings.COMMENTS_BANNED_USERS_GROUP] qs = qs.extra(where=where, params=params) - return qs + return qs[:40] Index: django/contrib/comments/views/comments.py =================================================================== --- django/contrib/comments/views/comments.py (.../branches/to-dj-trunk/vendor/django_dist/django/contrib/comments) (revision 1014) +++ django/contrib/comments/views/comments.py (.../trunk/vendor/django_dist/django/contrib/comments) (revision 1057) @@ -217,7 +217,7 @@ errors = manipulator.get_validation_errors(new_data) # If user gave correct username/password and wasn't already logged in, log them in # so they don't have to enter a username/password again. - if manipulator.get_user() and not manipulator.get_user().is_authenticated() and new_data.has_key('password') and manipulator.get_user().check_password(new_data['password']): + if manipulator.get_user() and new_data.has_key('password') and manipulator.get_user().check_password(new_data['password']): from django.contrib.auth import login login(request, manipulator.get_user()) if errors or request.POST.has_key('preview'):