rss feeds from django handled differently by firefox

95 views
Skip to first unread message

Bryan Murdock

unread,
Jun 12, 2006, 10:36:37 AM6/12/06
to django...@googlegroups.com
Djangonauts,

I'm not too well versed in this whole web application development
world yet, so maybe this is a dumb question...

When I click on a link to an RSS feed on a Wordpress powered blog, for
example, Firefox quickly displays the xml with fancy highlighting and
indentation and stuff. When I click on a link to an RSS feed on my
Django powered website, Firefox has no idea what to do with it and
prompts me with a dialog. I noticed that RSS feeds from
djangoproject.com and LjWord.com have the same issue. This is a bit
of a bummer because the quick nicely-formatted display that Firefox
does would make it very easy to verify that the feeds I'm creating
look sane. Does anyone know how to fix this?

Thanks,

Bryan

Bryan Murdock

unread,
Jun 12, 2006, 6:17:53 PM6/12/06
to django...@googlegroups.com
OK, it's the same with Internet Exploder. Here's two links to click
on and see if it's the same for you:

Displays nicely:

http://www.blueskyonmars.com/?feed=rss&cat=19

Doesn't:

http://www.djangoproject.com/rss/weblog/

Bryan

Eric Walstad

unread,
Jun 12, 2006, 7:36:17 PM6/12/06
to django...@googlegroups.com
On Monday 12 June 2006 15:17, Bryan Murdock wrote:
> OK, it's the same with Internet Exploder. Here's two links to click
> on and see if it's the same for you:
>
> Displays nicely:
>
> http://www.blueskyonmars.com/?feed=rss&cat=19
>
> Doesn't:
>
> http://www.djangoproject.com/rss/weblog/
>
> Bryan

Apparently firefox doesn't know what to do with rss version 2.0. Change it
to:
<rss version="0.92">
which is what is in the wordpress feed and it displays the way you want it (on
my machine, anyway).

Eric.

Eugene Lazutkin

unread,
Jun 12, 2006, 8:42:16 PM6/12/06
to django...@googlegroups.com
Bryan Murdock wrote:
> OK, it's the same with Internet Exploder. Here's two links to click
> on and see if it's the same for you:
>
> Displays nicely:
>
> http://www.blueskyonmars.com/?feed=rss&cat=19
>
> Doesn't:
>
> http://www.djangoproject.com/rss/weblog/
>
> Bryan

My feed displays nicely too: http://lazutkin.com/blog/rss201.xml. I
generate it with Django using RSS 2.0 spec courtesy of
django.utils.feedgenerator.Rss201rev2Feed. I suspect the difference is
due to different MIME type of these feeds --- I use 'application/xml',
which I believe is the correct one.

Thanks,

Eugene

James Bennett

unread,
Jun 13, 2006, 10:33:08 AM6/13/06
to django...@googlegroups.com
On 6/12/06, Eugene Lazutkin <eugene....@gmail.com> wrote:
> I suspect the difference is
> due to different MIME type of these feeds --- I use 'application/xml',
> which I believe is the correct one.

application/rss+xml for RSS
application/atom+xml for Atom

Browsers should prompt to download on these types, or if you've
configured a feed reader to handle them defer to the feed reader
instead.

--
"May the forces of evil become confused on the way to your house."
-- George Carlin

Bryan Murdock

unread,
Jun 13, 2006, 7:49:03 PM6/13/06
to django...@googlegroups.com
On 6/13/06, James Bennett <ubern...@gmail.com> wrote:
>
> On 6/12/06, Eugene Lazutkin <eugene....@gmail.com> wrote:
> > I suspect the difference is
> > due to different MIME type of these feeds --- I use 'application/xml',
> > which I believe is the correct one.
>
> application/rss+xml for RSS
> application/atom+xml for Atom
>
> Browsers should prompt to download on these types, or if you've
> configured a feed reader to handle them defer to the feed reader
> instead.

So are those the MIME types that django is returning for rss feeds (in
other words, how do I find out what MIME type django is using for
these)? In that case and from what you are saying, firefox is doing
the correct thing in asking me where to save the file instead of just
displaying it?

Thanks,

Bryan

James Bennett

unread,
Jun 13, 2006, 8:01:54 PM6/13/06
to django...@googlegroups.com
On 6/13/06, Bryan Murdock <bmur...@gmail.com> wrote:
> So are those the MIME types that django is returning for rss feeds (in
> other words, how do I find out what MIME type django is using for
> these)? In that case and from what you are saying, firefox is doing
> the correct thing in asking me where to save the file instead of just
> displaying it?

Yes and yes.

To find out the MIME-type Django is using, either look at the
Content-Type header it returns, or look at the feed-generating code,
which generates HttpResponses with those MIME-types.

coulix

unread,
Jun 13, 2006, 8:16:47 PM6/13/06
to Django users
applocation/rss+xml is what appears in the http headers.
It does not get display as an xml doc however :/


http://127.0.0.1:8000/feeds/nouvelles/

GET /feeds/nouvelles/ HTTP/1.1

Host: 127.0.0.1:8000

User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.0.4)
Gecko/20060508 Firefox/1.5.0.4

Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Language: en-us,fr;q=0.8,fr-fr;q=0.5,en;q=0.3

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive

Referer: http://127.0.0.1:8000/compte/coulix/

Cookie: sessionid=be7df207bc4edba9e0ca30f189d295aa;
__utma=96992031.993593871.1150179699.1150193251.1150210787.4;
__utmc=96992031;
__utmz=96992031.1150179699.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)

HTTP/1.x 200 OK

Date: Wed Jun 14 00:15:52 2006

Server: WSGIServer/0.1 Python/2.4.2

Vary: Cookie

Content-Type: application/rss+xml

Bryan Murdock

unread,
Jun 13, 2006, 8:18:32 PM6/13/06
to django...@googlegroups.com
On 6/13/06, Bryan Murdock <bmur...@gmail.com> wrote:

Answer to my own question that I found by digging through the django
code (which is much easier than I had anticipated!). The MIME type
for each feed is set in the feedgenerator.py:

http://code.djangoproject.com/browser/django/trunk/django/utils/feedgenerator.py

And it sets them just as James indicates. That probably explains why
firefox isn't displaying them like I wish.

As for Eugene's example, firefox does display it, and confirms that
the content-type header was application/xml. That isn't what django
sets for Rss201rev2Feeds. Maybe, Eugene, you are overriding that
somewhere in your code?

Thanks,

Bryan

James Bennett

unread,
Jun 13, 2006, 8:21:16 PM6/13/06
to django...@googlegroups.com
On 6/13/06, coulix <cou...@gmail.com> wrote:
> applocation/rss+xml is what appears in the http headers.
> It does not get display as an xml doc however :/

This is because browsers are NOT supposed to display feeds as XML documents.

Think of it like PDF -- instead of displaying the raw source text of
the PDF, the browser loads Adobe Acrobat. With a feed, instead of
displaying the raw XML the browser is supposed to hand off to a feed
reader. If you haven't told your browser or operating system what
program you use to read feeds, the default behavior, which is what
most people will see because they haven't done this configuration, is
to prompt you to download the document.

James Bennett

unread,
Jun 13, 2006, 8:22:24 PM6/13/06
to django...@googlegroups.com
On 6/13/06, Bryan Murdock <bmur...@gmail.com> wrote:
> And it sets them just as James indicates. That probably explains why
> firefox isn't displaying them like I wish.

Firefox is doing the right thing. Displaying raw XML to an end user is
not a good thing, and is more likely to make the user think they've
broken your site or done something wrong than anything else.

Eugene Lazutkin

unread,
Jun 13, 2006, 8:47:18 PM6/13/06
to django...@googlegroups.com
Bryan Murdock wrote:
>
> As for Eugene's example, firefox does display it, and confirms that
> the content-type header was application/xml. That isn't what django
> sets for Rss201rev2Feeds. Maybe, Eugene, you are overriding that
> somewhere in your code?

Yes, I override it. I remember having problems with some news
integrators with other MIME types. Like James said it should be
"application/rss+xml for RSS, application/atom+xml for Atom", but not
everybody conforms to the standard --- so I decided to declare it as XML.

Thanks,

Eugene

Reply all
Reply to author
Forward
0 new messages