Code

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#3608 closed (wontfix)

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

Reported by: ron@… Owned by: adrian
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: UI/UX:

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

Attachments (0)

Change History (4)

comment:1 Changed 7 years ago by Simon G. <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 7 years ago by Simon G. <dev@…>

  • Summary changed from CSS and Request Objects for RSS to enable CSS and include Request Objects in RSS framework for complex feeds

comment:3 Changed 7 years ago by mtredinnick

  • Resolution set to wontfix
  • Status changed from new to closed

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 Changed 7 years ago by ubernostrum

(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)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.