cement.ext.ext_print

Cement print extension module.

class cement.ext.ext_print.PrintDictOutputHandler(**kw: Any)[source]

Bases: OutputHandler

This class implements the Output Handler interface. It is intended primarily for development where printing out a string reprisentation of the data dictionary would be useful. Please see the developer documentation on Output Handling.

class Meta[source]

Bases: Meta

Handler meta-data

label: str = 'print_dict'

The string identifier of this handler.

overridable: bool = False

Whether or not to include json as an available choice to override the output_handler via command line options.

render(data: Dict[str, Any], *args: Any, **kw: Any) str[source]

Take a data dictionary and render it as text output. Note that the template option is received here per the interface, however this handler just ignores it.

Parameters:

data (dict) – The data dictionary to render.

Returns:

A text string.

Return type:

str

class cement.ext.ext_print.PrintOutputHandler(**kw: Any)[source]

Bases: OutputHandler

This class implements the Output Handler interface. It takes a dict and only prints out the out key. It is primarily used by the app.print() extended function in order to replace print() so that framework features like pre_render and post_render hooks are honored. Please see the developer documentation on Output Handling.

class Meta[source]

Bases: Meta

Handler meta-data

label: str = 'print'

The string identifier of this handler.

overridable: bool = False

Whether or not to include json as an available choice to override the output_handler via command line options.

render(data: Dict[str, Any], *args: Any, **kw: Any) str | None[source]

Take a data dictionary and render only the out key as text output. Note that the template option is received here per the interface, however this handler just ignores it.

Parameters:

data (dict) – The data dictionary to render.

Returns:

A text string.

Return type:

str