#6039 closed (fixed)
ATOM feed example is bogus
Reported by: | 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)
Change History (20)
by , 17 years ago
Attachment: | atom_feed.txt added |
---|
comment:1 by , 17 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:4 by , 17 years ago
Status: | new → assigned |
---|
comment:5 by , 17 years ago
Resolution: | → worksforme |
---|---|
Status: | assigned → closed |
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 , 17 years ago
Attachment: | worksforme.GIF added |
---|
comment:6 by , 17 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
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 , 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:9 by , 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 , 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:12 by , 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:14 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
sample code that generates a valid ATOM feed