cement.ext.ext_mustache
¶
Cement mustache extension module.
Note This extension has an external dependency on pystache
. Cement
explicitly does not include external dependencies for optional
extensions.
- In Cement
>=3.0.8
you must includecement[mustache]
in your applications dependencies. - In Cement
<3.0.8
you must includepystache
in your applications dependencies.
-
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.
-
class
Meta
[source]¶ Bases:
object
Handler meta-data.
-
overridable
= False¶ Whether or not to include
mustache
as an available to choice to override theoutput_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
ortemplate_dirs
prefix as defined in the application.Returns: The rendered template text Return type: str
-
class
-
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 includepystache
in your applications dependencies as Cement explicitly does not include external dependencies for optional extensions.