Opened 13 years ago

Closed 12 years ago

Last modified 11 years ago

#329 closed defect (fixed)

RSS framework needs an easier interface

Reported by: Jacob Owned by: Adrian Holovaty
Component: contrib.syndication Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


GarthK came up with a cool simpler interface to rss.FeedConfiguration:

We should use it, or something close to it.

Attachments (2)

SimplerFeedConfiguration.txt (4.4 KB) - added by Jacob 13 years ago.
new_rss.diff (8.9 KB) - added by anonymous 13 years ago.
Here is my work on the rss system

Download all attachments as: .zip

Change History (15)

Changed 13 years ago by Jacob

comment:1 Changed 13 years ago by garthk@…

Mind if I keep wading into it? I'd also like to modify links, add namespace support, and tackle a few other minor issues. I'll start maintaining it as a patch to the main code.

comment:2 Changed 13 years ago by Jacob

Please do -- what you've got so far rocks. When you've got something you're comfortable, modify this ticket to include [patch] in the title so we'll know it's ready for review.

comment:3 Changed 13 years ago by Adrian Holovaty

Component: Core frameworkRSS framework

comment:4 Changed 13 years ago by Jacob

Owner: changed from Adrian Holovaty to Jacob
Status: newassigned

comment:5 Changed 13 years ago by Jacob

milestone: Version 1.0

comment:6 Changed 13 years ago by Adrian Holovaty

This proposal is much more flexible but requires more code. How about allowing functions *or* attributes, so that these two would be equivalent:

class (SimplerFeedConfiguration):
    def description(self, feed_victim): 
        """Return the feed descrition."""
        return "Description"

class (SimplerFeedConfiguration):
    description = "Description"

Also, whatever solution we come up with shouldn't be a wrapper of the existing FeedConfiguration. Let's wrap feedgenerator directly.

Changed 13 years ago by anonymous

Attachment: new_rss.diff added

Here is my work on the rss system

comment:7 Changed 13 years ago by Eric Moritz

Type: defectenhancement

The new_rss.diff is my work on making the rss feed config work by extending a feed configuration class. It works without clobbering the existing system. I decided to keep the existing feed generator functionality so that the developer can decide which generator to use.

I also included the register_feed_modules to automagically registers any FeedConfiguration sub-classes within a list of modules. This will allow developers to put the FeedConfiguration classes anywhere. For instance if a prepackaged app has feed functionality, the developer that has added that app to his project wouldn't have to add the feed configuration to his module. He would simply have to add the name of the module containing the FeedConfiguration class to the list used in the call to register_feed_modules.

A good example of this could be with the comments app. It could have a feed config for the newest comments on the site in the module 'django.contrib.comments.feeds.comments' The user would install the feed with the code

feedconfig.register_feed_modules( ("django.contrib.comments.feeds.comments", None), )

The wonderful thing is that if a developer doesn't like how the title is displayed in the comments feed config, they can create their own module somewhere and extend the comments feed configuration:

from django.contrib.comments.feeds import comments
class MyLatestCommentsFeed(comments.LatestCommentsFeed):
  def get_item_title(self):
    title = comment.LatestCommentsFeed.get_item_title(self)
    return "My Comment Site:" + title
somewhere in myproject/settings/ 
  ("django.contrib.comments.feeds.comments", None), 
  ("myproject.feeds.my_feeds", None),

In this case, all the comments feeds are registered but because the second one is loaded second, it registers the custom feed under the same slug and overrides the class registered with feeds.comments

Please not that this is a prototype, although completely usable. I welcome any ideas to make it easier for developers.

comment:8 Changed 12 years ago by Adrian Holovaty

Owner: changed from Jacob to Adrian Holovaty
Status: assignednew

comment:9 Changed 12 years ago by Adrian Holovaty

Status: newassigned

comment:10 Changed 12 years ago by Adrian Holovaty

(In [1131]) Added django.core.rss.Feed -- the new RSS interface. Refs #329.

comment:11 Changed 12 years ago by Adrian Holovaty

Resolution: fixed
Status: assignedclosed

(In [1194]) Completely refactored legacy RSS framework to the new django.contrib.syndication package. Also added Atom support, changed the way feeds are registered and added documentation for the whole lot. This is backwards-incompatible, but the RSS framework had not yet been documented, so this should only affect tinkerers and WorldOnline. Fixes #329, #498, #502 and #554. Thanks for various patches/ideas to alastair, ismael, hugo, eric moritz and garthk

comment:12 Changed 12 years ago by Link

Type: enhancementdefect

comment:13 Changed 11 years ago by (none)

milestone: Version 1.0

Milestone Version 1.0 deleted

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