Opened 17 years ago

Closed 17 years ago

#4404 closed (fixed)

LatestCommentsFeed causing AssertionError due to slicing

Reported by: Stuart Williams <stuart@…> Owned by: Adrian Holovaty
Component: contrib.comments Version: dev
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Malcolm Tredinnick)

LatestCommentsFeed from contrib/comments/feeds.py calls upon LatestFreeCommentsFeed, which slices the result. This causes an AssertionError:

Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py"
in get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/syndication/
views.py" in feed
  19. feedgen = f(slug, request.path).get_feed(param)
File "/usr/lib/python2.5/site-packages/django/contrib/syndication/
feeds.py" in get_feed
  94. for item in self.__get_dynamic_attr('items', obj):
File "/usr/lib/python2.5/site-packages/django/contrib/syndication/
feeds.py" in __get_dynamic_attr
  51. return attr()
File "/usr/lib/python2.5/site-packages/django/contrib/comments/
feeds.py" in items
  36. qs = qs.filter(is_removed=False)
File "/usr/lib/python2.5/site-packages/django/db/models/query.py" in
filter
  368. return self._filter_or_exclude(None, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/db/models/query.py" in
_filter_or_exclude
  381. "Cannot filter a query once a slice has been taken."

  AssertionError at /rss/comments/
  Cannot filter a query once a slice has been taken. 

Sorry about the lack of further details, but I'm pretty new to both Python and Django... Thanks!

Attachments (1)

4404.patch (1.1 KB ) - added by Chris Beaven 17 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Chris Beaven, 17 years ago

Triage Stage: UnreviewedAccepted

Thanks for the report, Stuart. Glad we got to the bottom of this (this ticket follows an IRC troubleshooting session)

comment:2 by Chris Beaven, 17 years ago

To explain the problem, LatestCommentsFeed.items is getting a sliced queryset (from LatestFreeCommentsFeed.items) and then trying to filter on it. Which you can't do.

Here comes the patch...

by Chris Beaven, 17 years ago

Attachment: 4404.patch added

comment:3 by Chris Beaven, 17 years ago

Has patch: set
Triage Stage: AcceptedReady for checkin

comment:4 by Malcolm Tredinnick, 17 years ago

Description: modified (diff)

comment:5 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: newclosed

(In [5408]) Fixed #4404 -- Fixed LatestCommentsFeed query problem. Thanks, SmileyChris.

Note: See TracTickets for help on using tickets.
Back to Top