Django

Code

Ticket #6039 (reopened)

Opened 6 months ago

Last modified 3 months ago

ATOM feed example is bogus

Reported by: ion.morega@gmail.com Assigned to: stugots
Component: Documentation Version: SVN
Keywords: Cc:
Triage Stage: Accepted Has patch: 1
Needs documentation: 0 Needs tests: 0
Patch needs improvement: 0

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

atom_feed.txt (1.1 kB) - added by Ion Morega <ion.morega@gmail.com> on 11/27/07 13:55:12.
sample code that generates a valid ATOM feed
worksforme.GIF (50.7 kB) - added by stugots on 02/07/08 15:18:12.
6039.patch (67.2 kB) - added by stugots on 02/18/08 18:54:18.
Patch for this ticket.

Change History

11/27/07 13:55:12 changed by Ion Morega <ion.morega@gmail.com>

  • attachment atom_feed.txt added.

sample code that generates a valid ATOM feed

12/01/07 19:28:10 changed by Simon G <dev@simon.net.nz>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

02/07/08 13:06:45 changed by anonymous

  • owner changed from nobody to anonymous.
  • status changed from new to assigned.

02/07/08 13:07:08 changed by stugots

  • owner changed from anonymous to stugots.
  • status changed from assigned to new.

02/07/08 13:38:40 changed by stugots

  • status changed from new to assigned.

02/07/08 15:17:46 changed by stugots

  • status changed from assigned to closed.
  • resolution set to worksforme.

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!

02/07/08 15:18:12 changed by stugots

  • attachment worksforme.GIF added.

02/11/08 14:43:59 changed by Ion Morega <ion.morega@gmail.com>

  • status changed from closed to reopened.
  • resolution deleted.

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.

02/11/08 20:43:48 changed by stugots

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.

02/18/08 18:53:49 changed by stugots

  • has_patch set to 1.

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

02/18/08 18:54:18 changed by stugots

  • attachment 6039.patch added.

Patch for this ticket.

02/18/08 18:56:11 changed by stugots

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.

02/18/08 19:02:22 changed by stugots

[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.

02/18/08 19:03:24 changed by stugots

That should be #6545, not [6545].


Add/Change #6039 (ATOM feed example is bogus)




Change Properties
Action