class documentation

class BaseTemplate(object):

Known subclasses: bottle.SimpleTemplate, bottle.CheetahTemplate, bottle.Jinja2Template, bottle.MakoTemplate

View In Hierarchy

Base class and minimal API for template adapters
Class Method global​_config This reads or sets the global settings stored in class.settings.
Class Method search Search name in all directories specified in lookup. First without, then with common extensions. Return first hit.
Method __init__ No summary
Method prepare Run preparations (parsing, caching, ...). It should be possible to call this again to refresh a template or to update settings.
Method render No summary
Class Variable defaults Undocumented
Class Variable extensions Undocumented
Instance Variable encoding Undocumented
Instance Variable filename Undocumented
Instance Variable lookup Undocumented
Instance Variable name Undocumented
Instance Variable settings Undocumented
Instance Variable source Undocumented
@classmethod
def global_config(cls, key, *args):
This reads or sets the global settings stored in class.settings.
@classmethod
def search(cls, name, lookup=[]):
Search name in all directories specified in lookup. First without, then with common extensions. Return first hit.
def __init__(self, source=None, name=None, lookup=[], encoding='utf8', **settings):
Create a new template. If the source parameter (str or buffer) is missing, the name argument is used to guess a template filename. Subclasses can assume that self.source and/or self.filename are set. Both are strings. The lookup, encoding and settings parameters are stored as instance variables. The lookup parameter stores a list containing directory paths. The encoding parameter should be used to decode byte strings or files. The settings parameter contains a dict for engine-specific settings.
def prepare(self, **options):
Run preparations (parsing, caching, ...). It should be possible to call this again to refresh a template or to update settings.
def render(self, *args, **kwargs):
Render the template with the specified local variables and return a single byte or unicode string. If it is a byte string, the encoding must match self.encoding. This method must be thread-safe! Local variables may be provided in dictionaries (args) or directly, as keywords (kwargs).
defaults: dict =

Undocumented

extensions: list[str] =

Undocumented

encoding =

Undocumented

filename =

Undocumented

lookup =

Undocumented

name =

Undocumented

settings =

Undocumented

source =

Undocumented