#13110 closed New feature (fixed)
Allow multiple enclosures in Atom feeds
Reported by: | Piaume | Owned by: | Unai Zalakain |
---|---|---|---|
Component: | contrib.syndication | Version: | dev |
Severity: | Normal | Keywords: | multiple, enclosures, atom, feed 1.9 |
Cc: | kotenko@…, unai@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
For now, Feed.item_enclosure_url represents a single enclosure for an item. It should be nice to support many enclosures per item. Something like that:
class ExampleFeed(Feed): def item_enclosure_url(self, item): return [video.url for video in item.videos]
Change History (25)
comment:1 by , 15 years ago
milestone: | 1.2 → 1.3 |
---|
comment:2 by , 15 years ago
milestone: | 1.3 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 14 years ago
Cc: | added |
---|---|
Needs documentation: | set |
Needs tests: | set |
Owner: | changed from | to
Status: | new → assigned |
comment:4 by , 14 years ago
Triage Stage: | Accepted → Design decision needed |
---|
It appears that RSS only officially supports one enclosure per item {1}, and Atom supports multiple. Since RSS is the default feed, actually the use case presented in the bug report is invalid. The question then becomes, should we support multiple enclosures for Atom? As of now the enclosure is handled in the same general way in both types of feeds.
Changing to "Design Decision Needed" before I do anything else... Please let me know if that was the wrong thing to do in this situation, as I'm pretty new to the Django community.
{1} - http://www.rssboard.org/rss-profile#element-channel-item-enclosure
comment:5 by , 14 years ago
Type: | → New feature |
---|
comment:6 by , 14 years ago
Severity: | → Normal |
---|
follow-up: 8 comment:7 by , 13 years ago
Easy pickings: | unset |
---|---|
Triage Stage: | Design decision needed → Accepted |
UI/UX: | unset |
It should be possible to accept either a string or a list of string, and to validate that there's only one enclosure for RSS feeds.
comment:8 by , 9 years ago
Replying to aaugustin:
It should be possible to accept either a string or a list of string, and to validate that there's only one enclosure for RSS feeds.
Currently Feed
builds the Enclosure
from item_enclosure_url
, item_enclosure_length
and item_enclosure_mime_type
. Accepting an optional list for one of them would mean accepting optional lists for the three of them and that would become quite a strange and cumbersome API.
Instead, I propose creating a item_enclosures
attr/func (following the way all the rest are gotten) which, by default, returns a list with a single Enclosure
in it. That enclosure would be built using the url, length and mime_type gotten from the corresponding attrs.
RSS feeds could then validate that item_enclosures
is no longer than 1.
comment:9 by , 9 years ago
Cc: | added |
---|---|
Has patch: | set |
Keywords: | multiple enclosures atom feed added |
Owner: | changed from | to
Version: | 1.1 → master |
comment:10 by , 9 years ago
Could something along these lines be enough?
https://github.com/unaizalakain/django/commit/9acc50df64408d4023378ae4259fa1069b215ab2
comment:11 by , 9 years ago
I updated the commit with the proposed changes and opened a PR:
https://github.com/django/django/pull/5200
comment:12 by , 9 years ago
Patch needs improvement: | set |
---|
comment:13 by , 9 years ago
Needs documentation: | unset |
---|---|
Patch needs improvement: | unset |
Updated PR with docs.
comment:15 by , 9 years ago
Patch needs improvement: | set |
---|---|
Summary: | Multiple enclosures per feed's item → Allow multiple enclosures in Atom feeds |
I left comments for improvement on the pull request.
comment:17 by , 9 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:19 by , 9 years ago
Has patch: | unset |
---|---|
Keywords: | 1.9 added |
Resolution: | fixed |
Status: | closed → new |
Triage Stage: | Ready for checkin → Accepted |
Reopening per comments on the commit.
comment:20 by , 9 years ago
Has patch: | set |
---|
Sorry about that…
New PR: https://github.com/django/django/pull/5315
comment:22 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Feature Request.