Package genshi :: Package template :: Module text :: Class OldTextTemplate

Class OldTextTemplate

   object --+    
            |    
base.Template --+
                |
               OldTextTemplate

Legacy implementation of the old syntax text-based templates. This class is provided in a transition phase for backwards compatibility. New code should use the NewTextTemplate class and the improved syntax it provides.

>>> tmpl = OldTextTemplate('''Dear $name,
...
... We have the following items for you:
... #for item in items
...  * $item
... #end
...
... All the best,
... Foobar''')
>>> print tmpl.generate(name='Joe', items=[1, 2, 3]).render()
Dear Joe,
<BLANKLINE>
We have the following items for you:
 * 1
 * 2
 * 3
<BLANKLINE>
All the best,
Foobar
Nested Classes

Inherited from base.Template: __metaclass__

Instance Methods

Inherited from base.Template: __getstate__, __init__, __repr__, __setstate__, generate

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Variables
  directives = [('def', <class 'genshi.template.directives.DefDi...
  serializer = 'text'

Inherited from base.Template: EXEC, EXPR, INCLUDE, SUB

Properties

Inherited from object: __class__

Class Variable Details

directives

Value:
[('def', <class 'genshi.template.directives.DefDirective'>),
 ('when', <class 'genshi.template.directives.WhenDirective'>),
 ('otherwise',
  <class 'genshi.template.directives.OtherwiseDirective'>),
 ('for', <class 'genshi.template.directives.ForDirective'>),
 ('if', <class 'genshi.template.directives.IfDirective'>),
 ('choose', <class 'genshi.template.directives.ChooseDirective'>),
 ('with', <class 'genshi.template.directives.WithDirective'>)]