zephir.monitor.agentmanager.templates.MeasuresDataTmpl

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

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

      1  #!/usr/bin/env python
      2  # -*- coding: utf-8 --> -*-
      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
     24  ##################################################
     25  ## MODULE CONSTANTS
     26  try:
     27      True, False
     28  except NameError:
     29      True, False = (1==1), (1==0)
     30  VFFSL=valueFromFrameOrSearchList
     31  VFSL=valueFromSearchList
     32  VFN=valueForName
     33  currentTime=time.time
     34  __CHEETAH_version__ = '2.0.1'
     35  __CHEETAH_versionTuple__ = (2, 0, 1, 'final', 0)
     36  __CHEETAH_genTime__ = 1389100489.5369411
     37  __CHEETAH_genTimestamp__ = 'Tue Jan  7 14:14:49 2014'
     38  __CHEETAH_src__ = 'MeasuresDataTmpl.tmpl'
     39  __CHEETAH_srcLastModified__ = 'Tue Jan  7 14:06:55 2014'
     40  __CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
     41
     42  if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
     43      raise AssertionError(
     44        'This template was compiled with Cheetah version'
     45        ' %s. Templates compiled before version %s must be recompiled.'%(
     46           __CHEETAH_version__, RequiredCheetahVersion))
     47
     48  ##################################################
     49  ## CLASSES
     50
     51 -class MeasuresDataTmpl(Template):
     52
     53      ##################################################
     54      ## CHEETAH GENERATED METHODS
     55
     56
     57 -    def __init__(self, *args, **KWs):
     58
     59          Template.__init__(self, *args, **KWs)
     60          if not self._CHEETAH__instanceInitialized:
     61              cheetahKWArgs = {}
     62              allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
     63              for k,v in KWs.items():
     64                  if k in allowedKWs: cheetahKWArgs[k] = v
     65              self._initCheetahInstance(**cheetahKWArgs)
     66
     67
     68 -    def respond(self, trans=None):
     69
     70
     71
     72          ## CHEETAH: main method generated for this template
     73          if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
     74              trans = self.transaction # is None unless self.awake() was called
     75          if not trans:
     76              trans = DummyTransaction()
     77              _dummyTrans = True
     78          else: _dummyTrans = False
     79          write = trans.response().write
     80          SL = self._CHEETAH__searchList
     81          _filter = self._CHEETAH__currentFilter
     82
     83          ########################################
     84          ## START - generated method body
     85
     86          write('''<!-- MeasuresDataTmpl <table class="measures">
     87    <thead>
     88      <tr>
     89        <td>Date</td>
     90  ''')
     91          for f in VFFSL(SL,"data.fields",True): # generated from line 6, col 7
     92              write('''      <td>''')
     93              _v = VFFSL(SL,"f",True) # '$f' on line 7, col 11
     94              if _v is not None: write(_filter(_v, rawExpr='$f')) # from line 7, col 11.
     95              write('''</td>
     96  ''')
     97          write('''    </tr>
     98    </thead>
     99    <tbody>
    100  ''')
    101          for i in range(len(VFFSL(SL,"data.measures",True))): # generated from line 12, col 5
    102              if VFFSL(SL,"i",True) % 2 == 0: # generated from line 13, col 7
    103                  row_class = "even"
    104              else: # generated from line 15, col 7
    105                  row_class = "odd"
    106              m = VFN(VFFSL(SL,"data",True),"measures",True)[VFFSL(SL,"i",True)]
    107              write('''    <tr class="''')
    108              _v = VFFSL(SL,"row_class",True) # '$row_class' on line 19, col 16
    109              if _v is not None: write(_filter(_v, rawExpr='$row_class')) # from line 19, col 16.
    110              write('''">
    111        <td>''')
    112              _v = VFN(VFFSL(SL,"m",True),"get_date",False)() # '$m.get_date()' on line 20, col 11
    113              if _v is not None: write(_filter(_v, rawExpr='$m.get_date()')) # from line 20, col 11.
    114              write('''</td>
    115  ''')
    116              for f in VFFSL(SL,"data.fields",True): # generated from line 21, col 7
    117                  write('''      <td>''')
    118                  _v = VFN(VFFSL(SL,"m",True),"get_value",False)(VFFSL(SL,"f",True)) # '$m.get_value($f)' on line 22, col 11
    119                  if _v is not None: write(_filter(_v, rawExpr='$m.get_value($f)')) # from line 22, col 11.
    120                  write('''</td>
    121  ''')
    122              write('''    </tr>
    123  ''')
    124          write('''  </tbody>
    125    <tfoot>
    126      <tr>
    127  ''')
    128          nf = VFFSL(SL,"len",False)(VFFSL(SL,"data.fields",True))+1
    129          nm = VFFSL(SL,"len",False)(VFFSL(SL,"data.measures",True))
    130          write('''    <td colspan="''')
    131          _v = VFFSL(SL,"nf",True) # '$nf' on line 31, col 18
    132          if _v is not None: write(_filter(_v, rawExpr='$nf')) # from line 31, col 18.
    133          write('''" align="right">''')
    134          _v = VFFSL(SL,"nm",True) # '$nm' on line 31, col 37
    135          if _v is not None: write(_filter(_v, rawExpr='$nm')) # from line 31, col 37.
    136          write(''' measures</td>
    137      </tr>
    138    </tfoot>
    139  </table>
    140  ''')
    141
    142          ########################################
    143          ## END - generated method body
    144
    145          return _dummyTrans and trans.response().getvalue() or ""
    146
    147      ##################################################
    148      ## CHEETAH GENERATED ATTRIBUTES
    149
    150
    151      _CHEETAH__instanceInitialized = False
    152
    153      _CHEETAH_version = __CHEETAH_version__
    154
    155      _CHEETAH_versionTuple = __CHEETAH_versionTuple__
    156
    157      _CHEETAH_genTime = __CHEETAH_genTime__
    158
    159      _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
    160
    161      _CHEETAH_src = __CHEETAH_src__
    162
    163      _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
    164
    165      _mainCheetahMethod_for_MeasuresDataTmpl= 'respond'
    166
    167  ## END CLASS DEFINITION
    168
    169  if not hasattr(MeasuresDataTmpl, '_initCheetahAttributes'):
    170      templateAPIClass = getattr(MeasuresDataTmpl, '_CHEETAH_templateClass', Template)
    171      templateAPIClass._addCheetahPlumbingCodeToClass(MeasuresDataTmpl)
    172
    173
    174  # CHEETAH was developed by Tavis Rudd and Mike Orr
    175  # with code, advice and input from many other volunteers.
    176  # For more information visit http://www.CheetahTemplate.org/
    177
    178  ##################################################
    179  ## if run from command line:
    180  if __name__ == '__main__':
    181      from Cheetah.TemplateCmdLineIface import CmdLineIface
    182      CmdLineIface(templateObj=MeasuresDataTmpl()).run()
    183