Document templates defined from strings.
Document template strings use an extended form of python string
formatting. To insert a named value, simply include text of the
form: %(name)x
, where name
is the name of the value and x
is
a format specification, such as 12.2d
.
To intrduce a block such as an if
or an in
or a block continuation,
such as an else
, use [
as the format specification. To
terminate a block, ise ]
as the format specification, as in:
%(in results)[ %(name)s %(in results)]
There are no base classes.
There are no implemented interfaces.
TemplateDict
(type: classobj
)
<class zope.documenttemplate.pdocumenttemplate.TemplateDict at 0x418146bc>
commands
(type:
dict
)
{'comment': <class zope.documenttemplate.dt_var.Comment at 0x41814e6c>, 'unless': ('unless', 'dt_if', 'Unless'), 'raise': ('raise', 'dt_raise', 'Raise'), 'return': <class zope.documenttemplate.dt_return.ReturnTag at 0x41814e9c>, 'else': ('else', 'dt_if', 'Else'), 'try': ('try', 'dt_try', 'Try'), 'call': <class zope.documenttemplate.dt_var.Call at 0x41814d7c>, 'in': ('in', 'dt_in', 'In'), 'var': <class zope.documenttemplate.dt_var.Var at 0x41814d4c>, 'let': ('let', 'dt_let', 'Let'), 'with': ('with', 'dt_with', 'With'), 'if': ('if', 'dt_if', 'If')}
func_code
(type: instance
)
<zope.documenttemplate.dt_string.func_code instance at 0x4181c8cc>
func_defaults
(type:
tuple
)
()
shared_globals
(type:
dict
)
{}
validate
(type: NoneType
)
None
SubTemplate(name)
compile_python_expresssion(src)
cook(cooklock=<thread.lock object at 0x403da650>)
default(name=None, **kw)
Change or query default values in a document template.
If a name is specified, the value of the named default value before the operation is returned.
Keyword arguments are used to provide default values.
errQuote(s)
initvars(globals, vars)
munge(source_string=None, mapping=None, **vars)
Change the text or default values for a document template.
parse(text, start=0, result=None, tagre=None)
parseTag(match_ob, command=None, sargs='')
Parse a tag using an already matched re
Return: tag, args, command, coname
where: tag is the tag, args is the tag's argument string, command is a corresponding command info structure if the tag is a start tag, or None otherwise, and coname is the name of a continue tag (e.g. else) or None otherwise
parse_block(text, start, result, tagre, stag, sloc, sargs, scommand)
parse_close(text, start, tagre, stag, sloc, scommand, sa)
parse_error(mess, tag, text, start)
read(raw=None)
read_raw(raw=None)
skip_eol(text, start, eol=<_sre.SRE_Pattern object at 0x41815338>)
tagre()
var(name=None, **kw)
Change or query a variable in a document template.
If a name is specified, the value of the named variable before the operation is returned.
Keyword arguments are used to provide variable values.
varExtra(match_ob)