Exemplo n.º 1
0
def render(source, context, helpers=None, partials=None, knownHelpers=None,
        knownHelpersOnly=False):
    compiler = Compiler('casper')
    template = compiler.compile(source)
    # For real use, partials is a dict of compiled templates; but for testing
    # we compile just-in-time.
    if not partials:
        real_partials = None
    else:
        real_partials = dict((key, compiler.compile(value))
            for key, value in list(partials.items()))
    return str_class(template(context, helpers=helpers, partials=real_partials))