Thanks Michael!

Would you like me to submit a PR for the adjusted comment as per your 
suggestion?

All of my (Cornice) view functions are decorated like so:

@some_service.post(                                                        
                 
    content_type="application/json",                                        
                        
    accept="application/json",                                              
                        
    …
    )

which I think asks for the json renderer for responses. Unless, if I 
understand you correctly, the returned object is response object (instead 
of a dict or None or whatever).

So should I then use

def some_view_fun(request):
    …
    request.response.status = 201 # Created
    return None

instead of returning a HTTPCreated() here? 

Thank you!
Jens


On Thursday, November 2, 2017 at 1:48:02 AM UTC+10, Michael Merickel wrote:
>
> This renderer feature does not override the other one which is "if you 
> return a Response object then no renderers will be invoked". HTTPOk is a 
> Response subclass. This is covered in the first few paragraphs of the 
> renderer chapter. I'd be open to a PR that clarified the docs on this in 
> the section you linked since it does say "all views". It is infact "all 
> views that do not return something directly adaptable to a response such as 
> an implementer of IResponse, or an object whose type is registered as a 
> response adapter".
>
>
> https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/renderers.html#renderers
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/a89934fa-d7a5-487d-8790-0f370e999cbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to