On 11/05/2012 06:38 PM, Marten wrote:
Hello,
I'm working with Jinja2 templates but the response always renders as
text/html.
How can I change it to text/plain or text/xml for example on a specific
view? I don't want to write a new renderer for that. I know that I can
achieve this very cumbersome by getting the renderer, creating a
response object and defining content_type and body attributes then.
Is there a simple way to do this, like specifying a
response_content_type attribute in the view_config?
@view_config(renderer='foo.jinja2', ...)
def aview(request):
request.response.content_type = 'text/xml'
return {'a':1}
--
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.