cement.ext.ext_json
Cement json extension module.
- class cement.ext.ext_json.JsonConfigHandler(*args: Any, **kw: Any)[source]
Bases:
ConfigParserConfigHandlerThis class implements the Config Handler interface, and provides the same functionality of ConfigParserConfigHandler but with JSON configuration files.
- class Meta[source]
Bases:
MetaHandler meta-data.
- json_module = 'json'
Backend JSON library module to use (json, ujson).
- class cement.ext.ext_json.JsonOutputHandler(*args: Any, **kw: Any)[source]
Bases:
OutputHandlerThis class implements the Output Handler interface. It provides JSON output from a data dictionary using the json module of the standard library. Please see the developer documentation on Output Handling.
This handler forces Cement to suppress console output until
app.renderis called (keeping the output pure JSON). If troubleshooting issues, you will need to pass the--debugoption in order to unsuppress output and see what’s happening.- class Meta[source]
Bases:
MetaHandler meta-data
- json_module = 'json'
Backend JSON library module to use (json, ujson)
- _setup(app: App) None[source]
Called during application initialization and must
setupthe handler object making it ready for the framework or the application to make further calls to it.- Parameters:
app (instance) – The application object.
- cement.ext.ext_json.suppress_output_after_render(app: App, out_text: str) None[source]
This is a
post_renderhook that suppresses console output again after rendering, only if theJsonOutputHandleris triggered via command line.- Parameters:
app – The application object.