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 On Wed, Nov 1, 2017 at 3:23 AM, <jens.troe...@gmail.com> wrote: > Hello, > > The documentation for the default renderer for all views > <https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/renderers.html#adding-a-default-renderer> > seems to suggest that the following should work: > > from pyramid.renderers import JSON > > config = Configurator( > … > ) > config.add_renderer(None, JSON()) > > Alas, when one of the views returns HTTPOk() the response type is still > html. How to I make JSON the default renderer here for *all* views? > > Thanks! > Jens > > -- > 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/ms > gid/pylons-discuss/d730910a-2425-48fa-841b-4f891ddc525e%40googlegroups.com > <https://groups.google.com/d/msgid/pylons-discuss/d730910a-2425-48fa-841b-4f891ddc525e%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAKdhhwFOhrfHpF0BG9vjpm_S0q_Pq69jaofVNEZzVuksOOkcrg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.