def __init__(self, template, view=lambda x: x, content_type="text/html"): """ template -- Mustache template file, relative to Context's basedir view -- View function. This callable is passed the page object, and its return value is used by the template. Default is identity function. content_type -- content-type for output pages. Default 'text/html'. """ self.template = abspath(template) self.view = view self.content_type = content_type
def runMustache(tplname, *args, **kwds): if context(): tplname = abspath(tplname) tp = open(tplname).read() return pystache.render(tp, *args, **kwds)