Opened 10 years ago

Closed 7 years ago

Last modified 6 years ago

#6039 closed (fixed)

ATOM feed example is bogus

Reported by: ion.morega@… Owned by: John DeRosa
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The example code at the end of the syndication_feeds documentation page has a couple of problems that I discovered while trying to get the feed validator to accept my ATOM 1.0 feed:

The encoding "utf8" is invalid; it should be "utf-8".

An author name must be specified, either for the feed itself or for each entry - the author_name parameter.

The feed document must have a self link; this is set using the feed_url parameter when constructing the feed object.

I'm attaching the example code, modified with the above suggestions. Note that I added a few line breaks in the output of the script, to prevent exceedingly long lines.

Attachments (4)

atom_feed.txt (1.1 KB) - added by Ion Morega <ion.morega@…> 10 years ago.
sample code that generates a valid ATOM feed
worksforme.GIF (50.7 KB) - added by John DeRosa 10 years ago.
6039.patch (67.2 KB) - added by John DeRosa 10 years ago.
Patch for this ticket.
atom-feed.diff (1.2 KB) - added by arien 9 years ago.
patch against r8972

Download all attachments as: .zip

Change History (20)

Changed 10 years ago by Ion Morega <ion.morega@…>

Attachment: atom_feed.txt added

sample code that generates a valid ATOM feed

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

Triage Stage: UnreviewedAccepted

comment:2 Changed 10 years ago by anonymous

Owner: changed from nobody to anonymous
Status: newassigned

comment:3 Changed 10 years ago by John DeRosa

Owner: changed from anonymous to John DeRosa
Status: assignednew

comment:4 Changed 10 years ago by John DeRosa

Status: newassigned

comment:5 Changed 10 years ago by John DeRosa

Resolution: worksforme
Status: assignedclosed

I hope I'm doing this right -- this is the first Django ticket I've ever claimed.

I cannot reproduce your bug, using Python 2.5.1 and Django [7091], running on Windows XP.

I'm attaching a screenshot of my command window. I typed in the text at the bottom of http://www.djangoproject.com/documentation/syndication_feeds/, except for a shorter feed description attribute. And f.writeString() ran fine -- it accepted both 'utf8' or 'utf-8' for an encoding.

Perhaps feedgenerator changed since you opened this bug?

If the bug is still happening for you, then reopen this ticket. Thanks!

Changed 10 years ago by John DeRosa

Attachment: worksforme.GIF added

comment:6 Changed 10 years ago by Ion Morega <ion.morega@…>

Resolution: worksforme
Status: closedreopened

You are correct - the code does work, and produces the output you observed. But the problem is about producing *valid* ATOM feeds.

What I did was take the output of django.utils.feedgenerator, serve it via http, and verify it with http://feedvalidator.org/. In short, feedvalidator.org produces errors with the output in the documentation, and produces no errors after my modifications.

If you like, I can set up a small test server and serve both files so you can see the feedvalidator's output.

comment:7 Changed 10 years ago by John DeRosa

Duh! Sorry for misreading your problem report!

Thanks for the server offer, I'll let you know if I need that. I'll take a proper crack at this tomorrow.

comment:8 Changed 10 years ago by John DeRosa

Has patch: set

Attaching a patch for this ticket, in 6039.patch.

Changed 10 years ago by John DeRosa

Attachment: 6039.patch added

Patch for this ticket.

comment:9 Changed 10 years ago by John DeRosa

Ugh, that's ugly. I generated the patch on a Windows system, and the line endings must be different. I'll see if I can generate a shorter patch. The only lines I changed were the "Example Usage" section near the file's end.

comment:10 Changed 10 years ago by John DeRosa

[6545] refers to the line-ending problem with pool text files.

I couldn't find a way to make SVN do the right thing with the line-endings while generating the .patch file. Proposal to whomever evaluates this for check-in: Apply the patch on a *nix or Mac system, and then diff the result. You'll see I changed only the lines at the end of the file.

comment:11 Changed 10 years ago by John DeRosa

That should be #6545, not [6545].

Changed 9 years ago by arien

Attachment: atom-feed.diff added

patch against r8972

comment:12 Changed 9 years ago by arien

The output produced after applying the patch is a valid feed, as long as you assume the feed is located at http://www.example.com/atom.xml. This can be easily verified using the feedvalidator. (For example, running python src/demo.py /path/to/output.xml.)

comment:13 Changed 7 years ago by Joshua Russo

milestone: 1.2

Can this be included?

comment:14 Changed 7 years ago by Russell Keith-Magee

Resolution: fixed
Status: reopenedclosed

(In [13179]) Fixed #6039 -- Modified Atom example to be standard compliant. Thanks to ion.morega@… for the report, and arien for the patch.

comment:15 Changed 7 years ago by Russell Keith-Magee

(In [13181]) [1.1.X] Fixed #6039 -- Modified Atom example to be standard compliant. Thanks to ion.morega@… for the report, and arien for the patch.

Backport of r13179 from trunk.

comment:16 Changed 6 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

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