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

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

  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  from zephir.monitor.agentmanager.templates.SectionTmpl import SectionTmpl 
 25   
 26  ################################################## 
 27  ## MODULE CONSTANTS 
 28  try: 
 29      True, False 
 30  except NameError: 
 31      True, False = (1==1), (1==0) 
 32  VFFSL=valueFromFrameOrSearchList 
 33  VFSL=valueFromSearchList 
 34  VFN=valueForName 
 35  currentTime=time.time 
 36  __CHEETAH_version__ = '2.0.1' 
 37  __CHEETAH_versionTuple__ = (2, 0, 1, 'final', 0) 
 38  __CHEETAH_genTime__ = 1278598944.936166 
 39  __CHEETAH_genTimestamp__ = 'Thu Jul  8 16:22:24 2010' 
 40  __CHEETAH_src__ = 'ManagerPageTmpl.tmpl' 
 41  __CHEETAH_srcLastModified__ = 'Thu Jul  8 16:22:19 2010' 
 42  __CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine' 
 43   
 44  if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple: 
 45      raise AssertionError( 
 46        'This template was compiled with Cheetah version' 
 47        ' %s. Templates compiled before version %s must be recompiled.'%( 
 48           __CHEETAH_version__, RequiredCheetahVersion)) 
 49   
 50  ################################################## 
 51  ## CLASSES 
 52   
53 -class ManagerPageTmpl(PageTmpl):
54 55 ################################################## 56 ## CHEETAH GENERATED METHODS 57 58
59 - def __init__(self, *args, **KWs):
60 61 PageTmpl.__init__(self, *args, **KWs) 62 if not self._CHEETAH__instanceInitialized: 63 cheetahKWArgs = {} 64 allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split() 65 for k,v in KWs.items(): 66 if k in allowedKWs: cheetahKWArgs[k] = v 67 self._initCheetahInstance(**cheetahKWArgs)
68 69
70 - def respond(self, trans=None):
71 72 73 74 ## CHEETAH: main method generated for this template 75 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)): 76 trans = self.transaction # is None unless self.awake() was called 77 if not trans: 78 trans = DummyTransaction() 79 _dummyTrans = True 80 else: _dummyTrans = False 81 write = trans.response().write 82 SL = self._CHEETAH__searchList 83 _filter = self._CHEETAH__currentFilter 84 85 ######################################## 86 ## START - generated method body 87 88 write('''<!-- ManagerPageTmpl #encoding utf-8 --> 89 90 ''') 91 _v = VFFSL(SL,"head",False)("ZStats - " + VFFSL(SL,"hostname",True)) # '$head("ZStats - " + $hostname)' on line 5, col 1 92 if _v is not None: write(_filter(_v, rawExpr='$head("ZStats - " + $hostname)')) # from line 5, col 1. 93 write(''' 94 95 <SCRIPT LANGUAGE="JavaScript"> 96 <!-- 97 function clear() { 98 location.reload(false) 99 } 100 setTimeout ("clear()", 60000); 101 // --> 102 </SCRIPT> 103 104 <h1 id="title">''') 105 _v = VFFSL(SL,"description",True) # '$description' on line 16, col 16 106 if _v is not None: write(_filter(_v, rawExpr='$description')) # from line 16, col 16. 107 write('''</h1> 108 109 <div id="nav"> 110 ''') 111 if VFFSL(SL,"len",False)(VFFSL(SL,"manager.structure",True)) != 0: # generated from line 19, col 3 112 write(''' <ol> 113 ''') 114 if VFFSL(SL,"show_clients",True) == True: # generated from line 21, col 5 115 write(''' <li><a href="/agents/">Clients</a></li> 116 ''') 117 for section, agents in VFFSL(SL,"manager.structure",True): # generated from line 24, col 5 118 write(''' <li><a href="#''') 119 _v = VFFSL(SL,"section",True) # '$section' on line 25, col 19 120 if _v is not None: write(_filter(_v, rawExpr='$section')) # from line 25, col 19. 121 write('''">''') 122 _v = VFFSL(SL,"section",True) # '$section' on line 25, col 29 123 if _v is not None: write(_filter(_v, rawExpr='$section')) # from line 25, col 29. 124 write('''</a></li> 125 ''') 126 write(''' <li><a href="/agents/''') 127 _v = VFFSL(SL,"manager.client_name",True) # '$manager.client_name' on line 27, col 26 128 if _v is not None: write(_filter(_v, rawExpr='$manager.client_name')) # from line 27, col 26. 129 write('''/bilan/">Bilan Mensuel</a></li> 130 </ol> 131 ''') 132 write('''</div> <!-- nav --> 133 134 <div id="content"> 135 ''') 136 t = SectionTmpl() 137 t.depth = 2 138 t.content = VFFSL(SL,"manager.structure",True) 139 t.manager = VFFSL(SL,"manager",True) 140 _v = VFFSL(SL,"str",False)(VFFSL(SL,"t",True)) # '$str($t)' on line 38, col 1 141 if _v is not None: write(_filter(_v, rawExpr='$str($t)')) # from line 38, col 1. 142 write(''' 143 </div> <!-- content --> 144 145 ''') 146 _v = VFFSL(SL,"foot",False)() # '$foot()' on line 41, col 1 147 if _v is not None: write(_filter(_v, rawExpr='$foot()')) # from line 41, col 1. 148 write(''' 149 ''') 150 151 ######################################## 152 ## END - generated method body 153 154 return _dummyTrans and trans.response().getvalue() or ""
155 156 ################################################## 157 ## CHEETAH GENERATED ATTRIBUTES 158 159 160 _CHEETAH__instanceInitialized = False 161 162 _CHEETAH_version = __CHEETAH_version__ 163 164 _CHEETAH_versionTuple = __CHEETAH_versionTuple__ 165 166 _CHEETAH_genTime = __CHEETAH_genTime__ 167 168 _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__ 169 170 _CHEETAH_src = __CHEETAH_src__ 171 172 _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__ 173 174 _mainCheetahMethod_for_ManagerPageTmpl= 'respond'
175 176 ## END CLASS DEFINITION 177 178 if not hasattr(ManagerPageTmpl, '_initCheetahAttributes'): 179 templateAPIClass = getattr(ManagerPageTmpl, '_CHEETAH_templateClass', Template) 180 templateAPIClass._addCheetahPlumbingCodeToClass(ManagerPageTmpl) 181 182 183 # CHEETAH was developed by Tavis Rudd and Mike Orr 184 # with code, advice and input from many other volunteers. 185 # For more information visit http://www.CheetahTemplate.org/ 186 187 ################################################## 188 ## if run from command line: 189 if __name__ == '__main__': 190 from Cheetah.TemplateCmdLineIface import CmdLineIface 191 CmdLineIface(templateObj=ManagerPageTmpl()).run() 192