zephir.monitor.agentmanager.templates.SectionTmpl

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

# Source Code for Module zephir.monitor.agentmanager.templates.SectionTmpl

      1  #!/usr/bin/env python
      2
      3
      4
      5
      6  ##################################################
      7  ## DEPENDENCIES
      8  import sys
      9  import os
     10  import os.path
     11  from os.path import getmtime, exists
     12  import time
     13  import types
     14  import __builtin__
     15  from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
     16  from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
     17  from Cheetah.Template import Template
     18  from Cheetah.DummyTransaction import DummyTransaction
     19  from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
     20  from Cheetah.CacheRegion import CacheRegion
     21  import Cheetah.Filters as Filters
     22  import Cheetah.ErrorCatchers as ErrorCatchers
     23  from zephir.monitor.agentmanager.templates.AgentTmpl import AgentTmpl
     24
     25  ##################################################
     26  ## MODULE CONSTANTS
     27  try:
     28      True, False
     29  except NameError:
     30      True, False = (1==1), (1==0)
     31  VFFSL=valueFromFrameOrSearchList
     32  VFSL=valueFromSearchList
     33  VFN=valueForName
     34  currentTime=time.time
     35  __CHEETAH_version__ = '2.0.1'
     36  __CHEETAH_versionTuple__ = (2, 0, 1, 'final', 0)
     37  __CHEETAH_genTime__ = 1389100489.731297
     38  __CHEETAH_genTimestamp__ = 'Tue Jan  7 14:14:49 2014'
     39  __CHEETAH_src__ = 'SectionTmpl.tmpl'
     40  __CHEETAH_srcLastModified__ = 'Tue Jan  7 14:06:55 2014'
     41  __CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
     42
     43  if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
     44      raise AssertionError(
     45        'This template was compiled with Cheetah version'
     46        ' %s. Templates compiled before version %s must be recompiled.'%(
     47           __CHEETAH_version__, RequiredCheetahVersion))
     48
     49  ##################################################
     50  ## CLASSES
     51
     52 -class SectionTmpl(Template):
     53
     54      ##################################################
     55      ## CHEETAH GENERATED METHODS
     56
     57
     58 -    def __init__(self, *args, **KWs):
     59
     60          Template.__init__(self, *args, **KWs)
     61          if not self._CHEETAH__instanceInitialized:
     62              cheetahKWArgs = {}
     63              allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
     64              for k,v in KWs.items():
     65                  if k in allowedKWs: cheetahKWArgs[k] = v
     66              self._initCheetahInstance(**cheetahKWArgs)
     67
     68
     69 -    def respond(self, trans=None):
     70
     71
     72
     73          ## CHEETAH: main method generated for this template
     74          if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
     75              trans = self.transaction # is None unless self.awake() was called
     76          if not trans:
     77              trans = DummyTransaction()
     78              _dummyTrans = True
     79          else: _dummyTrans = False
     80          write = trans.response().write
     81          SL = self._CHEETAH__searchList
     82          _filter = self._CHEETAH__currentFilter
     83
     84          ########################################
     85          ## START - generated method body
     86
     87          write('''<!-- SectionTmpl #encoding utf-8 -->
     88
     89
     90  ''')
     91          for subtitle, agents in VFFSL(SL,"content",True): # generated from line 5, col 1
     92              if VFFSL(SL,"subtitle",True) is not None: # generated from line 6, col 3
     93                  write('''    <h''')
     94                  _v = VFFSL(SL,"depth",True)
     95                  if _v is not None: write(_filter(_v))
     96                  write(''' id="''')
     97                  _v = VFFSL(SL,"subtitle",True) # '$subtitle' on line 7, col 25
     98                  if _v is not None: write(_filter(_v, rawExpr='$subtitle')) # from line 7, col 25.
     99                  write('''">''')
    100                  _v = VFFSL(SL,"subtitle",True) # '$subtitle' on line 7, col 36
    101                  if _v is not None: write(_filter(_v, rawExpr='$subtitle')) # from line 7, col 36.
    102                  write('''</h''')
    103                  _v = VFFSL(SL,"depth",True)
    104                  if _v is not None: write(_filter(_v))
    105                  write('''>
    106  ''')
    107              write('''  <ul>
    108  ''')
    109              for name in VFFSL(SL,"agents",True): # generated from line 10, col 3
    110                  write('''    <li>''')
    111                  _v = VFFSL(SL,"str",False)(AgentTmpl(searchList=[{'name':VFFSL(SL,"name",True), 'manager':VFFSL(SL,"manager",True)}])) # "$str(AgentTmpl(searchList=[{'name':$name, 'manager':$manager}]))" on line 11, col 9
    112                  if _v is not None: write(_filter(_v, rawExpr="$str(AgentTmpl(searchList=[{'name':$name, 'manager':$manager}]))")) # from line 11, col 9.
    113                  write('''</li>
    114  ''')
    115              write('''  </ul>
    116  ''')
    117
    118          ########################################
    119          ## END - generated method body
    120
    121          return _dummyTrans and trans.response().getvalue() or ""
    122
    123      ##################################################
    124      ## CHEETAH GENERATED ATTRIBUTES
    125
    126
    127      _CHEETAH__instanceInitialized = False
    128
    129      _CHEETAH_version = __CHEETAH_version__
    130
    131      _CHEETAH_versionTuple = __CHEETAH_versionTuple__
    132
    133      _CHEETAH_genTime = __CHEETAH_genTime__
    134
    135      _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
    136
    137      _CHEETAH_src = __CHEETAH_src__
    138
    139      _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
    140
    141      _mainCheetahMethod_for_SectionTmpl= 'respond'
    142
    143  ## END CLASS DEFINITION
    144
    145  if not hasattr(SectionTmpl, '_initCheetahAttributes'):
    146      templateAPIClass = getattr(SectionTmpl, '_CHEETAH_templateClass', Template)
    147      templateAPIClass._addCheetahPlumbingCodeToClass(SectionTmpl)
    148
    149
    150  # CHEETAH was developed by Tavis Rudd and Mike Orr
    151  # with code, advice and input from many other volunteers.
    152  # For more information visit http://www.CheetahTemplate.org/
    153
    154  ##################################################
    155  ## if run from command line:
    156  if __name__ == '__main__':
    157      from Cheetah.TemplateCmdLineIface import CmdLineIface
    158      CmdLineIface(templateObj=SectionTmpl()).run()
    159