I read the View Deriver documentation and delightfully found that
Pyramid has some HTTP caching options I didn't know were there: the
'http_cache' arg to 'add_view_config', and 'response.expires' and
'response.cache_control'. That will save me from having to set
Cache-Control manually in a few views that use it.

On Tue, Oct 31, 2017 at 2:21 PM, Theron Luhn <the...@luhn.com> wrote:
> Ah, I didn't realize the renderer is called by a view deriver.  All I had to
> do was "config.add_view_deriver(view_marshaller, under='rendered_view',
> over=VIEW)" and got exactly what I was looking for.
>
> Thanks!
>
> On Sunday, October 29, 2017 at 11:16:22 PM UTC-7, Bert JW Regeer wrote:
>>
>> You can place a view deriver before the view is rendered by the current
>> renderer. Unless you are returning a Response object directly from your
>> view, you’d get the dictionary.
>>
>> For example, here are the default view derivers that Pyramid includes:
>>
>>
>> https://github.com/Pylons/pyramid/blob/master/pyramid/config/views.py#L1260
>>
>> You can install your new view deriver between rendererd_view and
>> mapped_view.
>>
>> This would allow you to return a dictionary from your view, and then you
>> can do with it as you please before passing it off to the rendered_view view
>> deriver.
>>
>> Bert
>>
>> On Oct 29, 2017, at 22:59, Theron Luhn <the...@luhn.com> wrote:
>>
>> My first thought was to use a view deriver, but calling the view outputs a
>> fully-formed Response object, so that’s a no-go.
>>
>>
>
>
> --
> 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/adde33da-c548-47a8-a148-c4b563a77d8b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Mike Orr <sluggos...@gmail.com>

-- 
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/CAH9f%3DurbL0Ym%2BhcZV5yafcvNhqpBhCa70vvimKfQ3CG2%2Bn3__w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to