def escape(s)
Replace special characters '&', '<', '>', ''', and '"' with the appropriate HTML escape sequences.
class TemplateError(Exception)
Template evaluation exception class.
pos = None | Character offset within the raw template at which the error occurred |
template = None | Template object |
lineNo = None | Line number |
contextLen = 2 | Error context length |
def __init__(self, message, pos, template)
def __str__(self)
class Template()
name = "<string>" | Name by which this template is referred to in exceptions. |
def __init__(self, txt, **nsDict)
def __str__(self)
Evaluate the template in the namespace provided at instantiation.
def __call__(self, **override)
A set of key/value pairs.
Evaluate the template, over-riding the instantiation namespace with the specified key/value pairs. Returns a string.
class File(Template)
Convenience class that extends Template to provide easy instantiation from a file.
def __init__(self, filename, **nsDict)
Copyright Nullcube 2008