class Loader(BaseLoader):
Undocumented
Method | __init__ |
Undocumented |
Method | cache_key |
Generate a cache key for the template name and skip. |
Method | generate_hash |
Undocumented |
Method | get_contents |
Undocumented |
Method | get_dirs |
Undocumented |
Method | get_template |
No summary |
Method | get_template_sources |
An iterator that yields possible matching template paths for a template name. |
Method | reset |
Empty the template cache. |
Instance Variable | get_template_cache |
Undocumented |
Instance Variable | loaders |
Undocumented |
Inherited from Loader
:
Instance Variable | engine |
Undocumented |
Generate a cache key for the template name and skip.
If skip is provided, only origins that match template_name are included in the cache key. This ensures each template is only parsed and cached once if contained in different extend chains like:
x -> a -> a y -> a -> a z -> a -> a
Perform the caching that gives this loader its name. Often many of the templates attempted will be missing, so memory use is of concern here. To keep it in check, caching behavior is a little complicated when a template is not found. See ticket #26306 for more details.
With template debugging disabled, cache the TemplateDoesNotExist class for every missing template and raise a new instance of it after fetching it from the cache.
With template debugging enabled, a unique TemplateDoesNotExist object is cached for each missing template to preserve debug data. When raising an exception, Python sets __traceback__, __context__, and __cause__ attributes on it. Those attributes can contain references to all sorts of objects up the call chain and caching them creates a memory leak. Thus, unraised copies of the exceptions are cached and copies of those copies are raised after they're fetched from the cache.