Re: [pylons-discuss] Recommended way to modify view return value

2017-10-31 Thread Mike Orr
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 view

Re: [pylons-discuss] Recommended way to modify view return value

2017-10-29 Thread Bert JW Regeer
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/py

[pylons-discuss] Recommended way to modify view return value

2017-10-29 Thread Theron Luhn
I’m trying to build a Pyramid equivalent to flask-apispec. I’d like to attach a schema to a view (marshmallow is the schema library I’m using) to validate the return value of the view and marshal it into something more readily JSON serializable. My first thought was to use a view deriver, but