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

Source Code for Module zephir.monitor.agentmanager.templates.TableDataTmpl

  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   
 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__ = 1278598945.7494371 
 37  __CHEETAH_genTimestamp__ = 'Thu Jul  8 16:22:25 2010' 
 38  __CHEETAH_src__ = 'TableDataTmpl.tmpl' 
 39  __CHEETAH_srcLastModified__ = 'Thu Jul  8 16:22:19 2010' 
 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 TableDataTmpl(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 #encoding utf-8 --> 87 <table class="table"> 88 <thead> 89 <tr> 90 ''') 91 for field, title, attrs, format in VFFSL(SL,"data.columns_format",True): # generated from line 5, col 7 92 write(''' <td ''') 93 _v = VFFSL(SL,"attrs",True) # '$attrs' on line 6, col 11 94 if _v is not None: write(_filter(_v, rawExpr='$attrs')) # from line 6, col 11. 95 write('''>''') 96 _v = VFFSL(SL,"title",True) # '$title' on line 6, col 18 97 if _v is not None: write(_filter(_v, rawExpr='$title')) # from line 6, col 18. 98 write('''</td> 99 ''') 100 write(''' </tr> 101 </thead> 102 <tbody> 103 ''') 104 if VFFSL(SL,"data.table_data",True) == None: # generated from line 11, col 5 105 write(''' <tr class="even"> 106 ''') 107 cols = VFFSL(SL,"len",False)(VFFSL(SL,"data.columns_format",True)) 108 write(''' <td colspan=''') 109 _v = VFFSL(SL,"cols",True) # '$cols' on line 14, col 19 110 if _v is not None: write(_filter(_v, rawExpr='$cols')) # from line 14, col 19. 111 write(''' ''') 112 _v = VFFSL(SL,"attrs",True) # '$attrs' on line 14, col 25 113 if _v is not None: write(_filter(_v, rawExpr='$attrs')) # from line 14, col 25. 114 write('''>Donn\xc3\xa9es non disponibles</td> 115 </tr> 116 ''') 117 else: # generated from line 16, col 5 118 for i in range(len(VFFSL(SL,"data.table_data",True))): # generated from line 17, col 5 119 if (VFFSL(SL,"i",True)+1) % 2 == 0: # generated from line 18, col 7 120 row_class = "even" 121 else: # generated from line 20, col 7 122 row_class = "odd" 123 row = VFN(VFFSL(SL,"data",True),"table_data",True)[VFFSL(SL,"i",True)] 124 write(''' <tr class="''') 125 _v = VFFSL(SL,"row_class",True) # '$row_class' on line 24, col 16 126 if _v is not None: write(_filter(_v, rawExpr='$row_class')) # from line 24, col 16. 127 write('''"> 128 ''') 129 for (field, title, attrs, format) in VFFSL(SL,"data.columns_format",True): # generated from line 25, col 7 130 write(''' <td ''') 131 _v = VFFSL(SL,"attrs",True) # '$attrs' on line 26, col 11 132 if _v is not None: write(_filter(_v, rawExpr='$attrs')) # from line 26, col 11. 133 write('''>''') 134 _v = VFFSL(SL,"format",False)(VFFSL(SL,"row",True)[VFFSL(SL,"field",True)]) # '$format($row[$field])' on line 26, col 18 135 if _v is not None: write(_filter(_v, rawExpr='$format($row[$field])')) # from line 26, col 18. 136 write('''</td> 137 ''') 138 write(''' </tr> 139 ''') 140 write(''' </tbody> 141 </table> 142 ''') 143 144 ######################################## 145 ## END - generated method body 146 147 return _dummyTrans and trans.response().getvalue() or ""
148 149 ################################################## 150 ## CHEETAH GENERATED ATTRIBUTES 151 152 153 _CHEETAH__instanceInitialized = False 154 155 _CHEETAH_version = __CHEETAH_version__ 156 157 _CHEETAH_versionTuple = __CHEETAH_versionTuple__ 158 159 _CHEETAH_genTime = __CHEETAH_genTime__ 160 161 _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__ 162 163 _CHEETAH_src = __CHEETAH_src__ 164 165 _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__ 166 167 _mainCheetahMethod_for_TableDataTmpl= 'respond'
168 169 ## END CLASS DEFINITION 170 171 if not hasattr(TableDataTmpl, '_initCheetahAttributes'): 172 templateAPIClass = getattr(TableDataTmpl, '_CHEETAH_templateClass', Template) 173 templateAPIClass._addCheetahPlumbingCodeToClass(TableDataTmpl) 174 175 176 # CHEETAH was developed by Tavis Rudd and Mike Orr 177 # with code, advice and input from many other volunteers. 178 # For more information visit http://www.CheetahTemplate.org/ 179 180 ################################################## 181 ## if run from command line: 182 if __name__ == '__main__': 183 from Cheetah.TemplateCmdLineIface import CmdLineIface 184 CmdLineIface(templateObj=TableDataTmpl()).run() 185