Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#3608 closed (wontfix)

enable CSS and include Request Objects in RSS framework for complex feeds

Reported by: ron@… Owned by: Adrian Holovaty
Component: contrib.syndication Version: 0.95
Severity: Keywords: RSS CSS
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I noticed that for RSS 2.0, and I believe Atom, has support for CSS. Many of the RSS readers I've been using to test my feeds with have very poor defaults for fonts and such and would like to include CSS. Currently I'm stuck using font tags and style attributes, but would love to simplify this with CSS. Here's a sample of the XML of RSS 2.0 with CSS:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://www.example.com/rss.css" ?>

Now for request objects being passed to the Feed classes. The idea for passing the request object to the Feeds is to have access to the GET variables to make the feeds a bit more dynamic. Two cases that I'm currently dealing with:

  1. First a news feed with several different topics
  2. An agricultural brokerage site with a listing feed

Both feeds general a large amount of articles and can be very cumbersome to sift through to find the content that the user needs. For the first case I can use the get_object method to reduce the Feed, but if a user would like two or more of the topics, he/she has to subscribe multiple times (trivial but could be improved). As for the second things get a lot more kludgey, especially using the get_object method.

For the second case I was hoping to provide a solution integrated with the search engine where the feed url would include the search engines GET variables (http://www.example.com/listings/rss/?AGE=...&STATUS=...&TYPE=...) to produce custom feeds. I think it would be simple enough to implement this by including one more items method to the feed classes to include one with the request object as the parameter:

class ExampleFeed(Feed):
    items(request) # The new method
    items(obj)     # The currently implemented methods
    items()
    items = []

I'm sorry if this should be two separate tickets, already has tickets or implemented in the development versions. I've attempted to make sure I'm not duplicated anything here, but my time is very tight (why I use django ;)). Thanks for the fantastic software!

Ron Wills

Change History (4)

comment:1 by Simon G. <dev@…>, 18 years ago

Triage Stage: UnreviewedDesign decision needed

comment:2 by Simon G. <dev@…>, 18 years ago

Summary: CSS and Request Objects for RSSenable CSS and include Request Objects in RSS framework for complex feeds

comment:3 by Malcolm Tredinnick, 18 years ago

Resolution: wontfix
Status: newclosed

This should definitely have been two separate tickets. It is asking for two different things. Be that as it may, I think we don't want to do either of those.

Including CSS in feeds is generally bad form: the client (reader) can configure the look that they want and the feed provider just provides the information. If you really have to include things like this, you can fairly easily subclass the feed generation class in django.utils.feedgenerator to add it, without needing to change core code. There will be a little bit of duplication, but not much.

Passing through the request obejct to the feed generator also sounds like a leaky abstraction. However, if you want to do request mangling, it is easy enough to write your own view to replace . django.contrib.syndication.views.feed(). It's only really a few lines of code. So we are not prohibiting any of these features, but since the alternative approaches aren't hard to implement, I don't believe they are worth including by default.

comment:4 by James Bennett, 18 years ago

(also, on the subject of styling feeds, note that Firefox and IE both will override your styles unless you resort to ugly hacks to trick their parsers)

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