Python pystache.Renderer() Examples

The following are 6 code examples of pystache.Renderer(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pystache , or try the search function .
Example #1
Source File: set-signatures.py    From gsuite-signature-manager with MIT License 6 votes vote down vote up
def change_signature(email, name, title):
    delegated_credentials = credentials.create_delegated(email)
    http_auth = delegated_credentials.authorize(Http())
    gmail = build('gmail', 'v1', http=http_auth)
    send_as_body = {
        'signature': Renderer().render_path('template.mustache', {
            'name': name,
            'title': title
        })
    }

    print('Changing signature for %s' % email)

    gmail.users().settings().sendAs().update(
        userId='me',
        sendAsEmail=email,
        body=send_as_body
    ).execute() 
Example #2
Source File: template.py    From Penny-Dreadful-Tools with GNU General Public License v3.0 5 votes vote down vote up
def render(view: 'BaseView') -> str:
    view.prepare()
    return render_name(view.template(), view)

# Subclass pystache.Renderer to provide our custom caching versions of pystache classes for performance reasons. 
Example #3
Source File: configure_spilo.py    From spilo with Apache License 2.0 5 votes vote down vote up
def pystache_render(*args, **kwargs):
    render = pystache.Renderer(missing_tags='strict')
    return render.render(*args, **kwargs) 
Example #4
Source File: generator.py    From mbed-cli with Apache License 2.0 5 votes vote down vote up
def generateCompleters(commands):
    txt = []

    renderer = pystache.Renderer(escape=lambda u: u)

    with open("templates/command.tmplt") as fp:
        tmplt = fp.read()

    for commandKey in commands:
        txt.append(renderer.render(tmplt, commands[commandKey]))

        # if need to add hacks add them here

    return txt 
Example #5
Source File: templating.py    From statik with MIT License 5 votes vote down vote up
def __init__(self, engine, **kwargs):
        super(StatikMustacheTemplateProvider, self).__init__(engine, **kwargs)
        logger.debug("Instantiating Mustache template provider")
        self.renderer = pystache.Renderer(partials=StatikMustachePartialGetter(self)) 
Example #6
Source File: functions.py    From droopescan with GNU Affero General Public License v3.0 5 votes vote down vote up
def template(template_file, variables={}):
    variables.update(colors)
    f = open(dscan.PWD + 'common/template/' + template_file, 'r')
    template = f.read()

    renderer = pystache.Renderer(search_dirs=dscan.PWD)
    return renderer.render(template, variables)