Hello list,

I'm trying to use the built-in json renderer to produce a json formatted response, but if I set the response content type to anything else, despite of explicitly naming the renderer via view_config, the response body is empty:


@view_config(route_name="test", request_method="POST", renderer="json")
def test_view(request)
    request.response.content_type = "application/vnd.myformat+json"
    return {"test" : "testing"}


The content type (and any other response header) is set properly, but the body is empty. I suppose I can "manually" produce the json output with a string renderer and some json.dumps() magic.

But is this expected? I haven't checked the internals, but I'd expect the renderer to set default content type before the view callable is executed and expect it to return a value which is JSON-serializeable, regardless of what response headers does the callable set.

Thanks.


--
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.

Reply via email to