geonature.utils.json

Classes

MyJSONProvider

Provide JSON operations using Python's built-in json

Functions

pagination_schema(schema)

Context manager to set the pagination schema for a given model.

Module Contents

geonature.utils.json.pagination_schema(schema)[source]

Context manager to set the pagination schema for a given model.

Parameters

schema : Model schema to use for pagination.

Notes

Usage:
with pagination_schema(UserSchema):

return jsonify(pagination)

class geonature.utils.json.MyJSONProvider(app: flask.sansio.app.App)[source]

Bases: flask.json.provider.DefaultJSONProvider

Provide JSON operations using Python’s built-in json library. Serializes the following additional data types:

static default(o)[source]

Apply this function to any object that json.dumps() does not know how to serialize. It should return a valid JSON type or raise a TypeError.