[pylons-discuss] Re: What should I use to inject data into multiple view responses before JSON rendering?

2024-04-16 Thread Pablo Díaz Ogni
Hello, after a whole week trying different approaches I finally went with using BeforeEvent subscriber + a view deriver to add specific option on `request.environ` about which ones should enhance the response: def my_view_deriver(view, info): def wrapper(context, request): if 'enhanc

[pylons-discuss] Re: What should I use to inject data into multiple view responses before JSON rendering?

2024-04-11 Thread Jonathan Vanasco
I don't know what is recommended, but have done similar things before. One way I've done something similar is to use a custom renderer in the `@view_config`. Another way I've accomplished this is to set a request attribute early on - either in a tween or in the view class instantiation or even