Package Cheetah :: Module Template :: Class Template
[show private | hide private]
[frames | no frames]

Class Template

       BaseServlet --+    
                     |    
               Servlet --+
                         |
_SettingsCollector --+   |
                     |   |
       SettingsManager --+
                         |
         WebInputMixin --+
                         |
                        Template

Known Subclasses:
AquariumTemplate

The core template engine.  It serves as a base class for Template
servlets and also knows how to compile a template.

Method Summary
  __init__(self, source, searchList, file, filter, filtersLib, errorCatcher, compilerSettings, **KWs)
Reads in the template definition, sets up the namespace searchList, processes settings, then compiles.
  compile(self, source, file, moduleName, mainMethodName)
Compile the template.
  errorCatcher(self)
Return a reference to the current errorCatcher...
  generatedClassCode(self)
Return the class code the compiler generated, or None if no compilation took place.
  generatedModuleCode(self)
Return the module code the compiler generated, or None if no compilation took place.
  getFileContents(self, path)
A hook for getting the contents of a file.
  getVar(self, varName, default, autoCall)
Get a variable from the searchList.
  hasVar(self, varName, autoCall)
Test if a variable name exists in the searchList.
  refreshCache(self, cacheRegionKey, cacheKey)
Refresh a cache item.
  runAsMainProgram(self)
Allows enable the Template to function as a standalone command-line program for static page generation.
  searchList(self)
Return a reference to the searchlist...
  shutdown(self)
Break reference cycles before discarding a servlet.
  varExists(self, varName, autoCall)
Test if a variable name exists in the searchList.
    Inherited from SettingsManager
  copySettings(self)
Returns a shallow copy of the settings dictionary...
  deepcopySettings(self)
Returns a deep copy of the settings dictionary...
  getConfigString(self)
Return a string with the settings in .ini file format.
  hasSetting(self, key)
True/False...
  setSetting(self, name, value)
Set a setting in self._settings.
  setting(self, name, default)
Get a setting from self._settings, with or without a default value.
  settings(self)
Return a reference to the settings dictionary...
  updateSettings(self, newSettings, merge)
Update the settings with a selective merge or a complete overwrite.
  updateSettingsFromConfigFile(self, path, **kw)
Update the settings from a text file using the syntax accepted by Python's standard ConfigParser module (like Windows .ini files).
  updateSettingsFromConfigFileObj(self, inFile, convert, merge)
See the docstring for .updateSettingsFromConfigFile() The caller of this method is responsible for closing the inFile file object.
  updateSettingsFromConfigStr(self, configStr, convert, merge)
See the docstring for .updateSettingsFromConfigFile()...
  updateSettingsFromPySrcFile(self, path, merge)
Update the settings from variables in a Python source file.
  updateSettingsFromPySrcStr(self, theString, merge)
Update the settings from a code in a Python src string.
  writeConfigFile(self, path)
Write all the settings that can be represented as strings to an .ini style config file.
    Inherited from Servlet
  __str__(self, trans)
  awake(self, transaction)
  respond(self, trans)
  serverSidePath(self, path, normpath, abspath)
  sleep(self, transaction)
    Inherited from WebInputMixin
  webInput(self, names, namesMulti, default, src, defaultInt, defaultFloat, badInt, badFloat, debug)
Import web transaction variables in bulk.

Class Variable Summary
    Inherited from Servlet
NoneType application = None                                                                  
NoneType request = None                                                                  
NoneType session = None                                                                  
NoneType transaction = None                                                                  

Method Details

__init__(self, source=None, searchList=[], file=None, filter='EncodeUnicode', filtersLib=<module 'Cheetah.Filters' from '/usr/lib/python2.4/site-p..., errorCatcher=None, compilerSettings={}, **KWs)
(Constructor)

Reads in the template definition, sets up the namespace searchList,
processes settings, then compiles.

Compiler configuration settings should be passed in as a dictionary via
the 'compilerSettings' keyword.

This method can also be called without arguments in cases where it is
called as a baseclass from a pre-compiled Template servlet.
Overrides:
Cheetah.SettingsManager.SettingsManager.__init__

compile(self, source=None, file=None, moduleName=None, mainMethodName='respond')

Compile the template. This method is automatically called by __init__
when __init__ is fed a file or source string.

errorCatcher(self)

Return a reference to the current errorCatcher

generatedClassCode(self)

Return the class code the compiler generated, or None if no
compilation took place.

generatedModuleCode(self)

Return the module code the compiler generated, or None if no
compilation took place.

getFileContents(self, path)

A hook for getting the contents of a file.  The default
implementation just uses the Python open() function to load local files.
This method could be reimplemented to allow reading of remote files via
various protocols, as PHP allows with its 'URL fopen wrapper'

getVar(self, varName, default=<class Cheetah.Template.NoDefault at 0xb79d086c>, autoCall=True)

Get a variable from the searchList.  If the variable can't be found
in the searchList, it returns the default value if one was given, or
raises NameMapper.NotFound.

hasVar(self, varName, autoCall=True)

Test if a variable name exists in the searchList.

refreshCache(self, cacheRegionKey=None, cacheKey=None)

Refresh a cache item.

runAsMainProgram(self)

Allows enable the Template to function as a standalone command-line
program for static page generation.

Type 'python yourtemplate.py --help to see what it's capabable of.

searchList(self)

Return a reference to the searchlist

shutdown(self)

Break reference cycles before discarding a servlet.
Overrides:
Cheetah.Servlet.Servlet.shutdown

varExists(self, varName, autoCall=True)

Test if a variable name exists in the searchList.

Generated by Epydoc 2.1 on Mon Jan 1 16:34:19 2007 http://epydoc.sf.net