本文整理匯總了Python中pystache.Renderer方法的典型用法代碼示例。如果您正苦於以下問題:Python pystache.Renderer方法的具體用法?Python pystache.Renderer怎麽用?Python pystache.Renderer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pystache
的用法示例。
在下文中一共展示了pystache.Renderer方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: change_signature
# 需要導入模塊: import pystache [as 別名]
# 或者: from pystache import Renderer [as 別名]
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()
示例2: render
# 需要導入模塊: import pystache [as 別名]
# 或者: from pystache import Renderer [as 別名]
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.
示例3: pystache_render
# 需要導入模塊: import pystache [as 別名]
# 或者: from pystache import Renderer [as 別名]
def pystache_render(*args, **kwargs):
render = pystache.Renderer(missing_tags='strict')
return render.render(*args, **kwargs)
示例4: generateCompleters
# 需要導入模塊: import pystache [as 別名]
# 或者: from pystache import Renderer [as 別名]
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
示例5: __init__
# 需要導入模塊: import pystache [as 別名]
# 或者: from pystache import Renderer [as 別名]
def __init__(self, engine, **kwargs):
super(StatikMustacheTemplateProvider, self).__init__(engine, **kwargs)
logger.debug("Instantiating Mustache template provider")
self.renderer = pystache.Renderer(partials=StatikMustachePartialGetter(self))
示例6: template
# 需要導入模塊: import pystache [as 別名]
# 或者: from pystache import Renderer [as 別名]
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)