mtemplate Module This module contains classes and functions for interfacing with template system. The MewloTemplateManager knows about all registered template types, and can find the right one to use given a template filename.

class mewlo.mpacks.core.template.mtemplate.MewloTemplate[source]

Bases: object

The MewloTemplate class represents a single template file.


Load a template from a file.


Load a template from a string.

render_sections(args={}, required_sections=[])[source]

Render template broken into sections defined by @@SECTIONAME = headers In addition, any section named ‘REM’ is ignored. In addition, all section values are trimmed (stripped) of leading and trailing whitespace


Render template into a string and return string. Use args dictionary to pass in values.

class mewlo.mpacks.core.template.mtemplate.MewloTemplateManager(mewlosite, debugmode)[source]

Bases: mewlo.mpacks.core.manager.manager.MewloManager

The MewloTemplateManager class is the helper object which implements or interfaces to all template processing functionality.

description = 'The template manager is used to help lookup view template files and serve them'

Return a string (with newlines and indents) that displays some debugging useful information about the object.

filename_endsin_list(filepath, endpatternlist)[source]

Return True if the filepath ends in one of the items in endpatternlist. Note this is different from checking the EXTENSION since here we can match on “*_jinja2.html” for example.

from_file(filepath, templatetypeid=None)[source]

Instantiate a template from a file.

lookup_templatetype_byfile(filepath, templatetypeid)[source]

Lookup a registered template type.


Lookup a registered template type.


Register a template type.

startup_prep(stageid, eventlist)[source]

This is invoked by site strtup, for each stage specified in startup_stages_needed() above.

typestr = 'core'

Table Of Contents

This Page