Package spade :: Module pyratemp :: Class TemplateBase
[hide private]
[frames] | no frames]

Class TemplateBase

source code


Basic template-class.

Used both for the template itself and for 'macro's ("subtemplates") in the template.

Instance Methods [hide private]
 
__init__(self, parsetree, data, renderfunc)
Create the Template/Subtemplate/Macro.
source code
 
__call__(self, **override)
Fill out/render the template.
source code
 
__unicode__(self)
Alias for __call__().
source code
 
__str__(self)
Only here for completeness.
source code
Method Details [hide private]

__init__(self, parsetree, data, renderfunc)
(Constructor)

source code 

Create the Template/Subtemplate/Macro.

:Parameter:

  • parsetree: parse-tree of the template/subtemplate/macro
  • data: data to fill into the template by default (dictionary). This data may later be overridden when rendering the template.
  • renderfunc: render-function

__call__(self, **override)
(Call operator)

source code 
Fill out/render the template.

:Parameters: 
    - override: objects to add to the data-namespace, overriding
                the "default"-data.
:Returns:    the filled template (in unicode)
:Note:       this is also called when invoking macros
             (i.e. "$!mymacro()!$").

__str__(self)
(Informal representation operator)

source code 

Only here for completeness. Use __unicode__ instead!