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