Django

Code

Ticket #329 (closed: fixed)

Opened 3 years ago

Last modified 2 years ago

RSS framework needs an easier interface

Reported by: jacob Assigned to: adrian
Milestone: Component: RSS framework
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

SimplerFeedConfiguration.txt (4.4 kB) - added by jacob on 08/15/05 16:16:22.
new_rss.diff (8.9 kB) - added by anonymous on 10/18/05 11:12:54.
Here is my work on the rss system

Change History

08/15/05 16:16:22 changed by jacob

  • attachment SimplerFeedConfiguration.txt added.

08/16/05 06:06:48 changed by garthk@gmail.com

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.

08/16/05 08:34:47 changed 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.

09/01/05 18:11:15 changed by adrian

  • component changed from Core framework to RSS framework.

09/30/05 08:59:14 changed by jacob

  • owner changed from adrian to jacob.
  • status changed from new to assigned.

09/30/05 09:01:12 changed by jacob

  • milestone set to Version 1.0.

10/08/05 18:28:11 changed 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.

10/18/05 11:12:54 changed by anonymous

  • attachment new_rss.diff added.

Here is my work on the rss system

10/18/05 11:42:48 changed 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 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.

11/08/05 17:18:08 changed by adrian

  • owner changed from jacob to adrian.
  • status changed from assigned to new.

11/08/05 17:18:11 changed by adrian

  • status changed from new to assigned.

11/08/05 18:50:01 changed by adrian

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

11/11/05 21:44:55 changed by adrian

  • status changed from assigned to closed.
  • resolution set to fixed.

(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

06/12/06 05:57:26 changed by Link

  • type changed from enhancement to defect.

01/17/07 16:12:17 changed by

  • milestone deleted.

Milestone Version 1.0 deleted


Add/Change #329 (RSS framework needs an easier interface)




Change Properties
Action