apicrud.initialize¶
initialize.py
created 9-jan-2021 by richb@instantlinux.net
Functions
|
flask headers and metrics - all responses get a cache-control header |
|
Initialize the Flask app defined by openapi.yaml: first four params must be passed from main; optional params here support unit-test framework. |
flask session setup - database and metrics |
|
flask locale |
|
|
Render function to provide message in dict as required for react-admin to display text of message for exception connexion.ProblemException |
|
Render function to provide message in dict as required for react-admin to display text of message for 4xx error codes |
-
apicrud.initialize.
after_request
(response)¶ flask headers and metrics - all responses get a cache-control header
-
apicrud.initialize.
app
(application, controllers, models, path, redis_conn=None, db_url=None, db_seed_file=None, func_send=None)¶ Initialize the Flask app defined by openapi.yaml: first four params must be passed from main; optional params here support unit-test framework.
- Parameters
application (obj) – a connexion object
controllers (obj) – all controllers
models (obj) – all models
path (str) – location of configuration .yaml / i18n files
db_seed_file (filename) – database records in yaml format
db_url (str) – URL of database
func_send (obj) – application’s function to send messages
redis_conn (obj) – connection to redis
- Returns
Flask app
- Return type
obj
-
apicrud.initialize.
before_request
()¶ flask session setup - database and metrics
-
apicrud.initialize.
get_locale
()¶ flask locale
-
apicrud.initialize.
render_problem
(error)¶ Render function to provide message in dict as required for react-admin to display text of message for exception connexion.ProblemException
- Parameters
error (obj) – the error object with name and description
-
apicrud.initialize.
render_status_4xx
(error)¶ Render function to provide message in dict as required for react-admin to display text of message for 4xx error codes
- Parameters
error (obj) – the error object with name and description