cement.ext.ext_mustache

Cement mustache extension module.

class cement.ext.ext_mustache.MustacheOutputHandler(*args, **kw)[source]

Bases: cement.core.output.OutputHandler

This class implements the Output Handler interface. It provides text output from template and uses the Mustache Templating Language. Please see the developer documentation on Output Handling.

Note This extension has an external dependency on pystache. You must include pystache in your applications dependencies as Cement explicitly does not include external dependencies for optional extensions.

class Meta[source]

Bases: object

Handler meta-data.

overridable = False

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

_setup(app)[source]

Called during application initialization and must setup the handler object making it ready for the framework or the application to make further calls to it.

Parameters:app (instance) – The application object.
render(data, template=None, **kw)[source]

Take a data dictionary and render it using the given template file. Additional keyword arguments passed to stache.render().

Parameters:data (dict) – The data dictionary to render.
Keyword Arguments:
 template (str) – The path to the template, after the template_module or template_dirs prefix as defined in the application.
Returns:The rendered template text
Return type:str
class cement.ext.ext_mustache.MustacheTemplateHandler(*args, **kw)[source]

Bases: cement.core.template.TemplateHandler

This class implements the Template Handler interface. It renderd content as template, and supports copying entire source template directories using the Mustache Templating Language. Please see the developer documentation on Template Handling.

Note This extension has an external dependency on pystache. You must include pystache in your applications dependencies as Cement explicitly does not include external dependencies for optional extensions.

class Meta[source]

Bases: object

Handler meta-data.

render(content, data)[source]

Render the given content as template with the data dictionary.

Parameters:
  • content (str) – The template content to render.
  • data (dict) – The data dictionary to render.
Returns:

The rendered template text

Return type:

str