Yep, I finally figured that out last night. I was about to post an
answer, but you beat me to it.
I'm using it to send text (or in one case rich text as .rtf to open it
up as a word doc).
Thanks for responding Dalius
On Mar 31, 10:28 pm, Dalius Dobravolskas
<[EMAIL PROTECTED]> wrote:
> johnnyice wrote:
> > James Gardner already posted how to set the content type when using
> > the render object in the forum.
>
> > response.headers['Content-type'] = "application/atom+xml"
> > return render("template_file", "atom-feed")
>
> > src:
> >http://groups.google.com/group/pylons-discuss/browse_thread/thread/2e...
>
> > BUT, how would you go about setting the content type for a Response
> > object?
>
> > This worked in 0.9.5, but does not work in 0.9.6.1
>
> > xml = '<result>Something</result>'
> > response = Response(xml)
> > response.headers['content-type'] = 'text/xml; charset=utf-8'
> > return response
>
> > Any ideas?
>
> Don't use Response object. Use response as James Garner offers. Your
> code should be written in this way:
>
> xml = '<result>Something</result>'
> response.headers['Content-type'] = 'text/xml; charset=utf-8'
> return xml
>
> Usually you should return string from controller (I think the only
> exception is @jsonify - you can return dict there). BTW, if you want to
> serve images this way it will be very slow. There are better ways to do
> that.
>
> Regards,
> Dalius
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---