kgk schrieb:
>
> Setting the content_type in 2.0Final a little painful (and felt like
> a regression)
> as you had to add
> pylons.response.headers['Content-Type'] = 'text/xml'
> to each routine instead of the TG 1. @expose(content_type="text/xml")
>
> However in 2.0.1 I seem to be unable to set the content_type under
> any circumstance.
> I have tried:
>
> @expose(content_type=CUSTOM_CONTENT_TYPE)
> def hello (self):
> pylons.response.headers['Content-Type'] = 'text/xml'
> return "<xml/>"
>
> and several other combinations of @expose to no avail..
>
> Any body know how one can set the content type properly with
> turbogears 2.0.1
> or should we be working with 2.1 already??
I works flawlessly for me in a freshly quickstarted project, with the
following controller-action:
@expose(content_type=CUSTOM_CONTENT_TYPE)
def index(self):
"""Handle the front-page."""
response.headers["Content-type"] = "text/xml"
return "<xml/>"
One minor thing I did differently was to use tg.response instead of
pylonse response. But that shouldn't make a difference.
Diez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---