Hello guys! I'm building an API using pyramid + pyramid_openapi3 package to 
use openapi3 features such as request validation, the web interface, and 
have well documented the endpoints. I'm having trouble understanding the 
different ways I can use views, view_derivers, tweens, decorators, etc.

Let's say I have multiple views that return its own data as a 
dictionary/list and I want to wrap the response with more info before 
rendering to JSON:
{request: <request_metadata>, response: <the actual data returned by the 
view>}

I first tried with tweens, but that's post renderization so I have to 
deserialize and serialize the json. I also tried view_derivers and I was 
facing the same issue. I also saw that you can match a view with a Context 
such as an exception, but not sure if there is a way to use that Context in 
other way such as "all the View objects that have this specific attribute"

I also tried a decorator with wrapper(context, request), but i switched 
from functions with @view_config to use View classes with get() method 
instead, so I should change the approach of the decorator

I'm new to pyramid and it has its own way of plugging views so I would like 
to know what is the recommended way of doing this?

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/f724e0e5-4e27-46fc-a892-b9c465c692f4n%40googlegroups.com.

Reply via email to