Opened 17 years ago

Closed 15 years ago

Last modified 13 years ago

#6039 closed (fixed)

ATOM feed example is bogus

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

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@…> 17 years ago.
sample code that generates a valid ATOM feed
worksforme.GIF (50.7 KB ) - added by John DeRosa 17 years ago.
6039.patch (67.2 KB ) - added by John DeRosa 17 years ago.
Patch for this ticket.
atom-feed.diff (1.2 KB ) - added by arien 16 years ago.
patch against r8972

Download all attachments as: .zip

Change History (20)

by Ion Morega <ion.morega@…>, 17 years ago

Attachment: atom_feed.txt added

sample code that generates a valid ATOM feed

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

Triage Stage: UnreviewedAccepted

comment:2 by anonymous, 17 years ago

Owner: changed from nobody to anonymous
Status: newassigned

comment:3 by John DeRosa, 17 years ago

Owner: changed from anonymous to John DeRosa
Status: assignednew

comment:4 by John DeRosa, 17 years ago

Status: newassigned

comment:5 by John DeRosa, 17 years ago

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!

by John DeRosa, 17 years ago

Attachment: worksforme.GIF added

comment:6 by Ion Morega <ion.morega@…>, 17 years ago

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 by John DeRosa, 17 years ago

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 by John DeRosa, 17 years ago

Has patch: set

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

by John DeRosa, 17 years ago

Attachment: 6039.patch added

Patch for this ticket.

comment:9 by John DeRosa, 17 years ago

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 by John DeRosa, 17 years ago

[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 by John DeRosa, 17 years ago

That should be #6545, not [6545].

by arien, 16 years ago

Attachment: atom-feed.diff added

patch against r8972

comment:12 by arien, 16 years ago

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 by Joshua Russo, 15 years ago

milestone: 1.2

Can this be included?

comment:14 by Russell Keith-Magee, 15 years ago

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 by Russell Keith-Magee, 15 years ago

(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 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

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