Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#14176 closed (fixed)

Error raised when using django.contrib.comments.feeds.LatestCommentsFeed

Reported by: psychcf Owned by: nobody
Component: contrib.comments Version: 1.2
Severity: Keywords: blocker, regression
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Whenever I access /rss/comments/ from my site, I get the following error:

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/Django-1.2.1-py2.5.egg/django/core/handlers/base.py", line 100, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/lib/python2.5/site-packages/Django-1.2.1-py2.5.egg/django/contrib/syndication/views.py", line 202, in feed
    feedgen = f(slug, request).get_feed(param)

TypeError: default __new__ takes no parameters

The code is just in urls.py, it should be fairly simple to reproduce:

# ...
from django.contrib.comments.feeds import LatestCommentFeed

feeds = {
     'comments': LatestCommentFeed,
}

urlpatterns = patterns('',
    # ...
    (r'^rss/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}),
)

Change History (10)

comment:1 by Jarek Zgoda, 14 years ago

Subclasses of LatestCommentFeed also raise this exception.

comment:2 by Omid Raha, 14 years ago

Hello ,

This problem is related to new django feeds changeset ,
because now , django comments feeds use class-based views :

http://code.djangoproject.com/changeset/12338/django/trunk/django/contrib/comments/feeds.py

read more about that , here :

http://docs.djangoproject.com/en/dev/releases/1.2/#feed-in-django-contrib-syndication-feeds

comment:3 by Zeth, 14 years ago

So in other words, you need to use an instance of the class instead of the class itself.

So instead of:

'comments': LatestCommentFeed,

You need:

'comments': LatestCommentFeed(),

It is a 'gotcha' but not a valid bug. This can be closed.

comment:4 by Russell Keith-Magee, 14 years ago

milestone: 1.3
Triage Stage: UnreviewedAccepted

This is definitely a bug -- the format described in the ticket report is the old format, but it should continue to work. Verified, and it's a major regression in 1.2

comment:5 by Russell Keith-Magee, 14 years ago

Keywords: blocker regression added

comment:6 by cwhaines, 14 years ago

I think I've found the source of this bug. django.contrib.comments.feeds.LatestCommentFeed inherits from django.contrib.syndication.views.Feed but the backwards compatible version of Feed is found in the django.contrib.comments.feeds module. Should the version in the django.contrib.comments.feeds be moved into django.contrib.comments.views and backwards compatible one put into its place instead?

comment:7 by cwhaines, 14 years ago

I just re-read my comment there's a typo:

I think I've found the source of this bug. django.contrib.comments.feeds.LatestCommentFeed? inherits from django.contrib.syndication.views.Feed but the backwards compatible version of Feed is found in the django.contrib.syndication.feeds module. Should the version in the django.contrib.comments.feeds be moved into django.contrib.comments.views and backwards compatible one put into its place instead?

comment:8 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

(In [15189]) Fixed #14176 -- Added forwards compatibility to the legacy syndication feed view. This allows class-based feeds to be deployed using the old-style feed view, as long as the feed requires no arguments (i.e., get_object returns None). Thanks to psychcf for the report, cwhaines for the investigation, and Andrew Godwin for the assist.

comment:9 by Russell Keith-Magee, 14 years ago

(In [15190]) [1.2.X] Fixed #14176 -- Added forwards compatibility to the legacy syndication feed view. This allows class-based feeds to be deployed using the old-style feed view, as long as the feed requires no arguments (i.e., get_object returns None). Thanks to psychcf for the report, cwhaines for the investigation, and Andrew Godwin for the assist.

Backport of r15189 from trunk.

comment:10 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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