Code

Opened 9 years ago

Last modified 14 months ago

#1028 assigned New feature

High-level feed framework should make more feed elements available

Reported by: ubernostrum Owned by: taxido
Component: contrib.syndication Version: master
Severity: Normal Keywords: djangocon
Cc: toke-django@…, dan90., girzel@… Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Currently, certain RSS and Atom elements can be populated only by making use of the "low-level" feed framework; this is particularly annoying in the case of certain common items such as the RSS category element. Ideally, all valid elements could be populated by use of the high-level framework, but in practice perhaps it would be best simply to determine which elements are needed in the most common use cases, and provide access to them.

One possible implementation would be to extend the high-level framework's use of the template system; instead of providing templates for the title and description elements, perhaps the high-level framework could allow specification of a template for the complete item element. For example, a publisher who wished to list the categories to which items belong would be able to include this in the template for items in an RSS feed:

{% for category in obj.get_category_list %}
<category>{{ category }}</category>
{% endfor %}

Attachments (3)

feeds_patch.diff (1.8 KB) - added by taojian 5 years ago.
feedtest_patch.diff (740 bytes) - added by taojian 5 years ago.
feedgenerator_patch.diff (5.4 KB) - added by taojian 5 years ago.

Download all attachments as: .zip

Change History (30)

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

  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 7 years ago by mtredinnick

  • Triage Stage changed from Design decision needed to Accepted

I don't know if the template approach is the correct one, but the sentiment of the bug report is correct: we are a bit restricted when it comes to creating full feeds.

comment:3 Changed 7 years ago by cmcavoy

  • Owner changed from nobody to cmcavoy
  • Status changed from new to assigned

taking a sprint stab at this, if anyone else wants to help i'm cmcavoy on irc.

comment:4 Changed 7 years ago by toke

  • Cc toke-django@… added

comment:5 Changed 7 years ago by PhiR

  • Keywords feature added

comment:6 Changed 7 years ago by PhiR

  • Keywords feature_request added; feature removed

comment:7 in reply to: ↑ description Changed 6 years ago by mikechambers

Replying to ubernostrum:

Try to document which RSS elements are not supported.

Looking at the RSS 2 spec:

http://blogs.law.harvard.edu/tech/rss

and

django.utils.feedgenerator.Rss201rev2Feed / RssFeed

It appears the the following optional rss.channel are missing:

managingEditor
webMaster
pubDate
generator
docs
cloud
image
rating
textInput
skpiHours
skipDays

comment:8 Changed 6 years ago by mikechambers

That is "I am trying to document which RSS elements are not supported". I will go over item elements next.

comment:9 Changed 6 years ago by ekarulf

  • Owner changed from cmcavoy to ekarulf
  • Status changed from assigned to new
  • Version set to SVN

RSS 2.0 Missing Elements:

Compared RSS 2.0 Spec against [source:django/trunk/django/utils/feedgenerator.py#7066 feedgenerator.py(r7066)]'s Rss201rev2Feed class

  • Channel
    • managingEditor
    • webMaster
    • pubDate
    • generator
    • docs
    • cloud
    • image
    • rating
    • textInput
    • skipHours
    • skipDays
  • Item
    • Currently contains TTL field, not specified in RSS 2.0 spec
    • pubDate
    • source

I'll take a shot at this later in the week, since I assume cmcavoy was not able to finish at the last sprint.

comment:10 follow-up: Changed 6 years ago by ekarulf

  • Status changed from new to assigned

comment:11 follow-up: Changed 6 years ago by dan <dan@…>

  • Cc dan@… added

Other things to think off include the entire idea of the extensibility of RSS - embedding [geographical information], say. Or is that getting off-topic?

More generally, as an RDF format, RSS 1.0 potentially includes the entire world of RDF as embeddable info, although presumably the humble django feed framework is not intended to encompass all of that.

comment:12 in reply to: ↑ 11 Changed 6 years ago by ekarulf

Replying to dan <dan@possumpalace.org>:

Other things to think off include the entire idea of the extensibility of RSS - embedding [geographical information], say. Or is that getting off-topic?

More generally, as an RDF format, RSS 1.0 potentially includes the entire world of RDF as embeddable info, although presumably the humble django feed framework is not intended to encompass all of that.

I think that might be getting a bit off topic. The syndication code defines the various feed formats using OO-style inheritance. I think that if someone wanted to embed geographical info (or any other bits) they could accomplish it using the existing framework. That said, I will see if I can't leave a hook to make extending more flexible.

comment:13 Changed 6 years ago by dan90

  • Cc dan90 added; dan@… removed

comment:14 in reply to: ↑ 10 ; follow-up: Changed 6 years ago by taojian

It would also be very nice to be able to specify feed stylesheets:

<?xml-stylesheet type="text/css" href="http://example.com/rss.css" ?>

class MyFeed(Feed):
    stylesheet = 'http://example.com/rss.css'

Unless this is already possible...?

comment:15 in reply to: ↑ 14 Changed 6 years ago by anonymous

Looking for discount prices on designer handbags? Visit http://www.designer-handbags-purses.com for the lowest prices on Coach handbags, Vera Bradley handbags and many other designer handbags. *

comment:16 Changed 5 years ago by taojian

  • Cc dan90., girzel@… added; dan90 removed

Looks like this is stalled again. I've got a basic patch for this mostly complete, adding these channel-level elements:

managing_editor
webmaster
generator
image
stylesheet
rating
cloud
skip_hours
skip_days

The others seemed esoteric or not useful. If anyone's got any half-complete patches lying around maybe we can consolidate them, otherwise I'll post a complete patch tomorrow.

Changed 5 years ago by taojian

Changed 5 years ago by taojian

comment:17 Changed 5 years ago by taojian

  • Has patch set
  • Owner changed from ekarulf to taojian
  • Status changed from assigned to new

There goes a preliminary patch, plus a slight tweak to the syndication tests. Docs to follow once there's some consensus that these are the right elements to add. I ended up leaving out rating, because half an hour of reading was insufficient to make sense of the specification, and it looks like something that isn't used all that much.

Other issues: Django now reports itself as the generator, unless generator is specifically overridden. I don't think django makes itself known in any other part of user output, so this might be undesirable. Also, the RSS specification has the cloud tag as an empty-element (self-closing) tag, but I couldn't get the xml generator to make anything other than a pair of open/close tags. From what I've read of the specs, this should be equally acceptable.

Changed 5 years ago by taojian

comment:18 Changed 5 years ago by taojian

Realized that the feedgenerator patch was RSS-centric: the stylesheet now goes on Atom feeds as well, and there's support for an icon element for Atom. Generator syntax is totally different for RSS and Atom; if we want to support that there will have to be separate attributes available for override.

comment:19 Changed 4 years ago by adamnelson

  • Patch needs improvement set

Setting Patch Needs Improvement to True since taojian said it was preliminary.

comment:20 Changed 4 years ago by anonymous

  • Version changed from SVN to 1.2-alpha

comment:21 Changed 3 years ago by lrekucki

  • Keywords feature_request removed
  • Needs documentation set
  • Severity changed from normal to Normal
  • Type changed from enhancement to New feature

None of the patches include any docs. I'm also lost which patches are supposed to be applied - it's best to keep everything in one patch.

comment:22 Changed 3 years ago by marclurr

  • Easy pickings unset
  • Owner changed from taojian to marclurr
  • Status changed from new to assigned
  • UI/UX unset

comment:23 Changed 3 years ago by marclurr

What's the consensus with regards to the solution for this? i.e. will be going with the template approach described above, or with the simpler solution implemented by taojian?

Edit: If the latter, I can consolidate the 3 patches and write some documentation, if the former I can implement that.

Last edited 3 years ago by marclurr (previous) (diff)

comment:24 Changed 3 years ago by marclurr

  • Owner changed from marclurr to nobody
  • Status changed from assigned to new

comment:25 Changed 2 years ago by tylerdavis

  • Owner changed from nobody to tylerdavis
  • Status changed from new to assigned

comment:26 Changed 2 years ago by tylerdavis

Hello all. This is my first attempt at working on a ticket, so thank you very much for your patience. I was hoping anyone that may have been involved with this ticket in the past could fill me in on what the specific goals are here. Obviously, I understand that the framework doesn't support all the currently supported rss 2.0 elements. It looks like the current patches have addressed that for the most part? What can I do to help complete this?

Thanks again

comment:27 Changed 14 months ago by taxido

  • Keywords djangocon added
  • Owner changed from tylerdavis to taxido
  • Version changed from 1.2-alpha to master

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as assigned
The owner will be changed from taxido to anonymous. Next status will be 'assigned'
The ticket will be disowned. Next status will be 'new'
as The resolution will be set. Next status will be 'closed'
Author


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

 
Note: See TracTickets for help on using tickets.