Package PyFoam :: Package Basics :: Module TemplateFile :: Class TemplateFile
[hide private]
[frames] | no frames]

Class TemplateFile

source code


Works on template files. Does calculations between $$. Lines that start with $$ contain definitions

Instance Methods [hide private]
 
__init__(self, name=None, content=None, encoding='utf-8', expressionDelimiter='|', assignmentLineStart='$$', specials=[], renderer_class=None, tolerantRender=False, allowExec=False)
Exactly one of the parameters must be specified
source code
 
buildTemplate(self, template) source code
 
getString(self, vals)
In the template, replaces all the strings between $$ with the evaluation of the expressions
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

    Inherited from TemplateFileOldFormat
 
writeToFile(self, outfile, vals)
In the template, replaces all the strings between $$ with the evaluation of the expressions and writes the results to a file
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name=None, content=None, encoding='utf-8', expressionDelimiter='|', assignmentLineStart='$$', specials=[], renderer_class=None, tolerantRender=False, allowExec=False)
(Constructor)

source code 

Exactly one of the parameters must be specified

Parameters:
  • name - name of the template file.
  • content - Content of the template
  • expressionDelimiter - character/string that delimits expression strings.
  • assignmentLineStart - Start of a line that holds an assignment operation
  • allowExec - allow execution (and import). This is potentially unsafe
  • special - list with strings that leave expression untreated
Overrides: object.__init__

buildTemplate(self, template)

source code 
Overrides: TemplateFileOldFormat.buildTemplate

getString(self, vals)

source code 

In the template, replaces all the strings between $$ with the evaluation of the expressions

Parameters:
  • vals - dictionary with the values
Returns:
The string with the replaced expressions
Overrides: TemplateFileOldFormat.getString