Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#329 closed defect (fixed)

RSS framework needs an easier interface

Reported by: jacob Owned by: adrian
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 10 years ago.
new_rss.diff (8.9 KB) - added by anonymous 10 years ago.
Here is my work on the rss system

Download all attachments as: .zip

Change History (15)

Changed 10 years ago by jacob

comment:1 Changed 10 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 10 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 10 years ago by adrian

  • Component changed from Core framework to RSS framework

comment:4 Changed 10 years ago by jacob

  • Owner changed from adrian to jacob
  • Status changed from new to assigned

comment:5 Changed 10 years ago by jacob

  • milestone set to Version 1.0

comment:6 Changed 10 years ago by adrian

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 10 years ago by anonymous

Here is my work on the rss system

comment:7 Changed 10 years ago by Eric Moritz

  • Type changed from defect to enhancement

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 10 years ago by adrian

  • Owner changed from jacob to adrian
  • Status changed from assigned to new

comment:9 Changed 10 years ago by adrian

  • Status changed from new to assigned

comment:10 Changed 10 years ago by adrian

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

comment:11 Changed 10 years ago by adrian

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

(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 9 years ago by Link

  • Type changed from enhancement to defect

comment:13 Changed 9 years ago by anonymous

  • milestone Version 1.0 deleted

Milestone Version 1.0 deleted

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