Kind of FAQ.
Use CodernityREST decorators (not @ from python), you can add decorator to:
With good combination of those 3 “levels” you can do everything you want.
If all requests should have it add it to global_dec, if just some then use ResourceRouter dec, if only one function then use single route dec. And read ... do something before/after request.
It’s very easy. Just add a pre_app_hook like
def my_json_hook(app): app.content_types['application/json'] = (my_json_load_funct, my_json_dump_funct)
The same way to add and change existing content_types.
app_hook is way to go. It is a list of hooks that will be executed just before app is returned to wsgi server. You have access to your newly configured app via app argument (or first one in hook).
pre_app_hook is way to go. It is a list of hooks that will be executed before any configuration is made. You have access to your newly created app via app argument (or first one in hook).
UNMAPPED_EX_PROCESSORS is the way to go, it’s a list of functions that will be executed on non mapped exception (not defined in ExceptionMap). Sentry integration is done like this:
def unmapped_ex_to_sentry(obj, *args, **kwargs): client.captureException()