Will `render_to_response` ever return something that is not `pyramid.response.Response`?

11 views
Skip to first unread message

Jonathan Vanasco

unread,
Oct 12, 2020, 2:48:40 PM10/12/20
to pylons-discuss

I've looked at the code and am pretty sure the answer is no, but a bunch of subclasses are used here, so I think it's best to ask --  Will render_to_response ever return something that is not `pyramid.response.Response`?

I have a small library that will act on the output of render_to_response; I am trying to catch edge cases where it is improperly invoked and a developer passes in a normal dict (which would be rendered via view_config template or json renderer) instead of the expected output of render_to_response.

Michael Merickel

unread,
Oct 12, 2020, 4:16:40 PM10/12/20
to pylons-...@googlegroups.com
There is a null_renderer in Pyramid, but it's not available via render_to_response. I do not see a code path that would return anything other than an object implementing pyramid.interfaces.IResponse (the expected return value from the app's configured IResponseFactory). This is, of course, slightly more general than pyramid.response.Response.

- Michael

On Oct 12, 2020, at 13:48, 'Jonathan Vanasco' via pylons-discuss <pylons-...@googlegroups.com> wrote:

I've looked at the code and am pretty sure the answer is no, but a bunch of subclasses are used here, so I think it's best to ask --  Will render_to_response ever return something that is not `pyramid.response.Response`?

I have a small library that will act on the output of render_to_response; I am trying to catch edge cases where it is improperly invoked and a developer passes in a normal dict (which would be rendered via view_config template or json renderer) instead of the expected output of render_to_response.


--
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-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/32fddda9-dba9-4c84-a26a-c0a28a6953dbn%40googlegroups.com.

Jonathan Vanasco

unread,
Oct 12, 2020, 5:40:29 PM10/12/20
to pylons-discuss
Thank you, Michael!

This helps me a lot.
Reply all
Reply to author
Forward
0 new messages