zephir.monitor.agentmanager.templates.ServerPageTmpl

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

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

      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.PageTmpl import PageTmpl
     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__ = 1389100488.9166679
     38  __CHEETAH_genTimestamp__ = 'Tue Jan  7 14:14:48 2014'
     39  __CHEETAH_src__ = 'ServerPageTmpl.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 ServerPageTmpl(PageTmpl):
     53
     54      ##################################################
     55      ## CHEETAH GENERATED METHODS
     56
     57
     58 -    def __init__(self, *args, **KWs):
     59
     60          PageTmpl.__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('''<!-- ServerPageTmpl #encoding utf-8 -->
     88
     89  ''')
     90          _v = VFFSL(SL,"head",False)("Zephir") # '$head("Zephir")' on line 5, col 1
     91          if _v is not None: write(_filter(_v, rawExpr='$head("Zephir")')) # from line 5, col 1.
     92          write('''
     93
     94  <h1 id="title">Zephir</h1>
     95
     96  <div id="nav">
     97  </div>
     98
     99  <div id="content">
    100    <ul><!-- FIXME could be paginated -->
    101  ''')
    102          for c in VFFSL(SL,"clients",True): # generated from line 14, col 3
    103              write('''    <li><a href="/agents/''')
    104              _v = VFFSL(SL,"c",True) # '$c' on line 15, col 26
    105              if _v is not None: write(_filter(_v, rawExpr='$c')) # from line 15, col 26.
    106              write('''/">''')
    107              _v = VFFSL(SL,"c",True) # '$c' on line 15, col 31
    108              if _v is not None: write(_filter(_v, rawExpr='$c')) # from line 15, col 31.
    109              write('''</a></li>
    110  ''')
    111          write('''  </ul>
    112  </div> <!-- content -->
    113
    114  ''')
    115          _v = VFFSL(SL,"foot",False)() # '$foot()' on line 20, col 1
    116          if _v is not None: write(_filter(_v, rawExpr='$foot()')) # from line 20, col 1.
    117          write('''
    118  ''')
    119
    120          ########################################
    121          ## END - generated method body
    122
    123          return _dummyTrans and trans.response().getvalue() or ""
    124
    125      ##################################################
    126      ## CHEETAH GENERATED ATTRIBUTES
    127
    128
    129      _CHEETAH__instanceInitialized = False
    130
    131      _CHEETAH_version = __CHEETAH_version__
    132
    133      _CHEETAH_versionTuple = __CHEETAH_versionTuple__
    134
    135      _CHEETAH_genTime = __CHEETAH_genTime__
    136
    137      _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
    138
    139      _CHEETAH_src = __CHEETAH_src__
    140
    141      _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
    142
    143      _mainCheetahMethod_for_ServerPageTmpl= 'respond'
    144
    145  ## END CLASS DEFINITION
    146
    147  if not hasattr(ServerPageTmpl, '_initCheetahAttributes'):
    148      templateAPIClass = getattr(ServerPageTmpl, '_CHEETAH_templateClass', Template)
    149      templateAPIClass._addCheetahPlumbingCodeToClass(ServerPageTmpl)
    150
    151
    152  # CHEETAH was developed by Tavis Rudd and Mike Orr
    153  # with code, advice and input from many other volunteers.
    154  # For more information visit http://www.CheetahTemplate.org/
    155
    156  ##################################################
    157  ## if run from command line:
    158  if __name__ == '__main__':
    159      from Cheetah.TemplateCmdLineIface import CmdLineIface
    160      CmdLineIface(templateObj=ServerPageTmpl()).run()
    161