module loaders
function make_template_system_loader
make_template_system_loader(
loader: 'BaseLoader',
auto_reload: 'bool' = True,
namespace_key: 'str' = '',
cache_size: 'int' = 300,
additional_loaders: 'Optional[Sequence[BaseLoader]]' = None
) → BaseLoader
make_template_system_loader A TemplateSystemLoader
factory
Args:
loader
(BaseLoader): The loader to use when loading the rendering templesauto_reload
(bool, optional): IfTrue
, loaders that have anuptodate
callable will reload template source data automatically. Defaults to Falsenamespace_key
(str, optional): The name of a global render context variable or loader keyword argument that resolves to the current loader "namespace" or "scope". Defaults to ""cache_size
(int, optional): The capacity of the template cache in number of templates. cache_size less than 1 disables caching. Defaults to 300additional_loaders
(Optional[Sequence[BaseLoader]], optional): The additional loaders to use when a template is not found by the loader. Defaults to None
Returns:
BaseLoader
:CachingTemplateSystemLoader
if cache_size > 0 elseTemplateSystemLoader
function read_text
read_text(env: 'Environment', filename: 'str') → str
read_text Reads the text from the given filename using the Environment's loader to retrieve the file's contents
Args:
env
(Environment): the rendering environmentfilename
(str): the name of the file
Returns:
str
: the contents of the file if the file could be found
Raises:
FileNotFoundError
: when the file could not be found
class TemplateSystemLoader
TemplateSystemLoader allows templates to be loaded from a primary and optionally secondary location(s). This allows templates to include / render templates from the other location(s)
Template Names Resolution: Any template (non json file) that is in a subdirectory will have _ prepended to the name Ex: Section/Immunization -> Section/_Immunization
See ChoiceLoader
for more information
method get_source
get_source(env: 'Environment', template_name: 'str') → TemplateSource
method get_source_async
get_source_async(env: 'Environment', template_name: 'str') → TemplateSource
method get_source_with_args
get_source_with_args(
env: 'Environment',
template_name: 'str',
**kwargs: 'object'
) → TemplateSource
method get_source_with_args_async
get_source_with_args_async(
env: 'Environment',
template_name: 'str',
**kwargs: 'object'
) → TemplateSource
method get_source_with_context
get_source_with_context(
context: 'Context',
template_name: 'str',
**kwargs: 'str'
) → TemplateSource
method get_source_with_context_async
get_source_with_context_async(
context: 'Context',
template_name: 'str',
**kwargs: 'str'
) → TemplateSource
class CachingTemplateSystemLoader
TemplateSystemLoader that caches parsed templates in memory.
See TemplateSystemLoader
for more information
method __init__
__init__(
loaders: 'List[BaseLoader]',
auto_reload: 'bool' = True,
namespace_key: 'str' = '',
cache_size: 'int' = 300
) → None
method get_source
get_source(env: 'Environment', template_name: 'str') → TemplateSource
method get_source_async
get_source_async(env: 'Environment', template_name: 'str') → TemplateSource
method get_source_with_args
get_source_with_args(
env: 'Environment',
template_name: 'str',
**kwargs: 'object'
) → TemplateSource
method get_source_with_args_async
get_source_with_args_async(
env: 'Environment',
template_name: 'str',
**kwargs: 'object'
) → TemplateSource
method get_source_with_context
get_source_with_context(
context: 'Context',
template_name: 'str',
**kwargs: 'str'
) → TemplateSource
method get_source_with_context_async
get_source_with_context_async(
context: 'Context',
template_name: 'str',
**kwargs: 'str'
) → TemplateSource
This file was automatically generated via lazydocs.