class documentation

class Loader(BaseLoader):

View In Hierarchy

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
def __init__(self, engine, loaders):
def cache_key(self, template_name, skip=None):

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
def generate_hash(self, values):

Undocumented

def get_contents(self, origin):

Undocumented

def get_dirs(self):

Undocumented

def get_template(self, template_name, skip=None):

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.

def get_template_sources(self, template_name):
An iterator that yields possible matching template paths for a template name.
def reset(self):
Empty the template cache.
get_template_cache: dict =

Undocumented

loaders =

Undocumented