Package zephir :: Package monitor :: Package agentmanager :: Package templates :: Module AgentTmpl :: Class AgentTmpl
[frames] | no frames]

Class AgentTmpl

source code

                 object --+            
                          |            
Cheetah.Servlet.BaseServlet --+        
                              |        
        Cheetah.Servlet.Servlet --+    
                                  |    
          Cheetah.Template.Template --+
                                      |
                                     AgentTmpl

Instance Methods
 
__init__(self, *args, **KWs)
a) compiles a new template OR b) instantiates an existing template.
source code
 
respond(self, trans=None) source code

Inherited from Cheetah.Template.Template: errorCatcher, generatedClassCode, generatedModuleCode, getCacheRegion, getCacheRegions, getFileContents, getVar, hasVar, i18n, refreshCache, runAsMainProgram, searchList, shutdown, varExists, webInput

Inherited from Cheetah.Servlet.Servlet: awake, serverSidePath, sleep

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

Class Methods

Inherited from Cheetah.Template.Template: compile, subclass

Class Variables

Inherited from Cheetah.Template.Template: NonNumericInputError

Inherited from Cheetah.Servlet.Servlet: application, request, session, transaction

Properties

Inherited from object: __class__

Method Details

__init__(self, *args, **KWs)
(Constructor)

source code 
a) compiles a new template OR b) instantiates an existing template.

Read this docstring carefully as there are two distinct usage patterns.
You should also read this class' main docstring.

a) to compile a new template:
     t = Template(source=aSourceString)
         # or 
     t = Template(file='some/path')
         # or 
     t = Template(file=someFileObject)
         # or
     namespaces = [{'foo':'bar'}]               
     t = Template(source=aSourceString, namespaces=namespaces)
         # or 
     t = Template(file='some/path', namespaces=namespaces)

     print t
     
b) to create an instance of an existing, precompiled template class:
     ## i) first you need a reference to a compiled template class:
     tclass = Template.compile(source=src) # or just Template.compile(src)
         # or 
     tclass = Template.compile(file='some/path')
         # or 
     tclass = Template.compile(file=someFileObject)
         # or 
     # if you used the command line compiler or have Cheetah's ImportHooks
     # installed your template class is also available via Python's
     # standard import mechanism:
     from ACompileTemplate import AcompiledTemplate as tclass
     
     ## ii) then you create an instance
     t = tclass(namespaces=namespaces)
         # or 
     t = tclass(namespaces=namespaces, filter='RawOrEncodedUnicode')
     print t

Arguments:
  for usage pattern a)           
    If you are compiling a new template, you must provide either a
    'source' or 'file' arg, but not both:          
      - source (string or None)
      - file (string path, file-like object, or None)

    Optional args (see below for more) :
      - compilerSettings
       Default: Template._CHEETAH_compilerSettings=None
       
       a dictionary of settings to override those defined in
       DEFAULT_COMPILER_SETTINGS.  See
       Cheetah.Template.DEFAULT_COMPILER_SETTINGS and the Users' Guide
       for details.

    You can pass the source arg in as a positional arg with this usage
    pattern.  Use keywords for all other args.           

  for usage pattern b)
    Do not use positional args with this usage pattern, unless your
    template subclasses something other than Cheetah.Template and you
    want to pass positional args to that baseclass.  E.g.:
      dictTemplate = Template.compile('hello $name from $caller', baseclass=dict)
      tmplvars = dict(name='world', caller='me')
      print dictTemplate(tmplvars)
    This usage requires all Cheetah args to be passed in as keyword args.

  optional args for both usage patterns:

    - namespaces (aka 'searchList')
      Default: None
      
      an optional list of namespaces (dictionaries, objects, modules,
      etc.) which Cheetah will search through to find the variables
      referenced in $placeholders.

      If you provide a single namespace instead of a list, Cheetah will
      automatically convert it into a list.
        
      NOTE: Cheetah does NOT force you to use the namespaces search list
      and related features.  It's on by default, but you can turn if off
      using the compiler settings useSearchList=False or
      useNameMapper=False.
        
     - filter
       Default: 'EncodeUnicode'
       
       Which filter should be used for output filtering. This should
       either be a string which is the name of a filter in the
       'filtersLib' or a subclass of Cheetah.Filters.Filter. . See the
       Users' Guide for more details.

     - filtersLib
       Default: Cheetah.Filters
       
       A module containing subclasses of Cheetah.Filters.Filter. See the
       Users' Guide for more details. 

     - errorCatcher
       Default: None

       This is a debugging tool. See the Users' Guide for more details.
       Do not use this or the #errorCatcher diretive with live
       production systems.

  Do NOT mess with the args _globalSetVars or _preBuiltSearchList!

Overrides: Cheetah.Template.Template.__init__
(inherited documentation)

respond(self, trans=None)

source code 
Overrides: Cheetah.Servlet.Servlet.respond