cement.ext.ext_print

Cement print extension module.

class cement.ext.ext_print.PrintDictOutputHandler(**kw)[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: object

Handler meta-data

label = 'print_dict'

The string identifier of this handler.

overridable = False

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

render(data_dict, template=None, **kw)[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 (dict) – The data dictionary to render.

Keyword Arguments:

template – This option is completely ignored.

Returns:

A text string.

Return type:

str

class cement.ext.ext_print.PrintOutputHandler(**kw)[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: object

Handler meta-data

label = 'print'

The string identifier of this handler.

overridable = False

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

render(data_dict, template=None, **kw)[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 (dict) – The data dictionary to render.

Keyword Arguments:

template – This option is completely ignored.

Returns:

A text string.

Return type:

str