Opened 18 years ago
Last modified 17 years ago
#4404 closed
LatestCommentsFeed causing AssertionError due to slicing — at Version 4
Reported by: | 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 )
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!
Change History (5)
comment:1 by , 18 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 18 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 , 18 years ago
Attachment: | 4404.patch added |
---|
comment:3 by , 18 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
comment:4 by , 17 years ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.
Thanks for the report, Stuart. Glad we got to the bottom of this (this ticket follows an IRC troubleshooting session)