Opened 19 years ago

Closed 18 years ago

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

Description

GarthK came up with a cool simpler interface to rss.FeedConfiguration: http://django.pastebin.com/337395

We should use it, or something close to it.

Attachments (2)

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

Download all attachments as: .zip

Change History (15)

by Jacob, 19 years ago

comment:1 by garthk@…, 19 years ago

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 by Jacob, 19 years ago

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 by Adrian Holovaty, 19 years ago

Component: Core frameworkRSS framework

comment:4 by Jacob, 18 years ago

Owner: changed from Adrian Holovaty to Jacob
Status: newassigned

comment:5 by Jacob, 18 years ago

milestone: Version 1.0

comment:6 by Adrian Holovaty, 18 years ago

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.

by anonymous, 18 years ago

Attachment: new_rss.diff added

Here is my work on the rss system

comment:7 by Eric Moritz, 18 years ago

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 main_rss.py 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:

myproject/feeds.py: 
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/main.py: 
...
feedconfig.register_feed_modules( 
  ("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 by Adrian Holovaty, 18 years ago

Owner: changed from Jacob to Adrian Holovaty
Status: assignednew

comment:9 by Adrian Holovaty, 18 years ago

Status: newassigned

comment:10 by Adrian Holovaty, 18 years ago

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

comment:11 by Adrian Holovaty, 18 years ago

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 by Link, 18 years ago

Type: enhancementdefect

comment:13 by (none), 17 years ago

milestone: Version 1.0

Milestone Version 1.0 deleted

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