MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / template

Function template

thirdparty/bottle/bottle.py:4611–4635  ·  view source on GitHub ↗

Get a rendered template as a string iterator. You can use a name, a filename or a template string as first parameter. Template rendering arguments can be passed as dictionaries or directly (as keyword arguments).

(*args, **kwargs)

Source from the content-addressed store, hash-verified

4609
4610
4611def template(*args, **kwargs):
4612 """
4613 Get a rendered template as a string iterator.
4614 You can use a name, a filename or a template string as first parameter.
4615 Template rendering arguments can be passed as dictionaries
4616 or directly (as keyword arguments).
4617 """
4618 tpl = args[0] if args else None
4619 for dictarg in args[1:]:
4620 kwargs.update(dictarg)
4621 adapter = kwargs.pop('template_adapter', SimpleTemplate)
4622 lookup = kwargs.pop('template_lookup', TEMPLATE_PATH)
4623 tplid = (id(lookup), tpl)
4624 if tplid not in TEMPLATES or DEBUG:
4625 settings = kwargs.pop('template_settings', {})
4626 if isinstance(tpl, adapter):
4627 TEMPLATES[tplid] = tpl
4628 if settings: TEMPLATES[tplid].prepare(**settings)
4629 elif "\n" in tpl or "{" in tpl or "%" in tpl or '$' in tpl:
4630 TEMPLATES[tplid] = adapter(source=tpl, lookup=lookup, **settings)
4631 else:
4632 TEMPLATES[tplid] = adapter(name=tpl, lookup=lookup, **settings)
4633 if not TEMPLATES[tplid]:
4634 abort(500, 'Template (%s) not found' % tpl)
4635 return TEMPLATES[tplid].render(kwargs)
4636
4637
4638mako_template = functools.partial(template, template_adapter=MakoTemplate)

Callers 2

default_error_handlerMethod · 0.85
wrapperFunction · 0.85

Calls 5

abortFunction · 0.85
updateMethod · 0.45
popMethod · 0.45
prepareMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…