7.4.2 CachingTemplateLoaderMixin

The CachingTemplateLoaderMixin class caches loaded templates to and only reloads them if they have been modified since they were last loaded.

__init__( base_dir)
When you inherit from the CachingTemplateLoaderMixin class you must call the constructor to define the root directory where template files will be loaded in the base_dir argument.

load_template( name)
Return the parsed template file specified in the name argument. The path to the template file is constructed by performing os.path.join() on the base_dir specified in the constructor and the name argument.

If there is an error reading the template a TemplateLoadError will be raised.

If the template has been previously loaded it will only be reloaded if it has been modified since last load.

load_template_once( name)
Call the load_template() method and return the template if it is either loaded for the first time or reloaded, else return None.