4 messages in com.googlegroups.pylons-discussRe: Setting the content type in Pylon...
FromSent OnAttachments
alecf26 Sep 2007 15:09 
James Gardner26 Sep 2007 15:40 
alecf26 Sep 2007 17:38 
alecf30 Sep 2007 15:28 
Subject:Re: Setting the content type in Pylons 0.9.6
From:James Gardner (jame@public.gmane.org)
Date:09/26/2007 03:40:26 PM
List:com.googlegroups.pylons-discuss

Hi Alec,

You need:

response.headers['Content-type'] = "application/atom+xml" return render("genshi-xml", "atom-feed")

James

alecf wrote:

I'm trying to render some Atom feeds with Pylons - I've got a genshi template that more or less renders the atom feed, but I need to return it as application/atom+xml

For the life of me I can't figure out how the new global response object works - setting content_type has no effect.. my controller looks something like:

response.content_type = "application/atom+xml" response.content = render("genshi-xml", "atom-feed")

(I had to write my own 'genshi-xml' engine plugin wrapper for Genshi, because Genshi's default requires the file extension to be .html, but that's a whole other story...)