Opened 5 years ago

Closed 4 years ago

Last modified 3 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: UI/UX:

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 Changed 5 years ago by zgoda

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Subclasses of LatestCommentFeed also raise this exception.

comment:2 Changed 4 years ago by OmidRaha

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 Changed 4 years ago by zeth

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 Changed 4 years ago by russellm

  • milestone set to 1.3
  • Triage Stage changed from Unreviewed to Accepted

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 Changed 4 years ago by russellm

  • Keywords blocker regression added

comment:6 Changed 4 years ago by cwhaines

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 Changed 4 years ago by cwhaines

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 Changed 4 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(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 Changed 4 years ago by russellm

(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 Changed 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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