Package zephir :: Package monitor :: Package agentmanager :: Package templates :: Module ManagerPageTmpl
[hide private]
[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.0rc7' 
 37  __CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 7) 
 38  __CHEETAH_genTime__ = 1190887606.9169869 
 39  __CHEETAH_genTimestamp__ = 'Thu Sep 27 12:06:46 2007' 
 40  __CHEETAH_src__ = 'ManagerPageTmpl.tmpl' 
 41  __CHEETAH_srcLastModified__ = 'Tue Jan 23 10:43:33 2007' 
 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 -->\n\n') 89 _v = VFFSL(SL,"head",False)("Zephir &mdash; " + VFFSL(SL,"host",True)) # '$head("Zephir &mdash; " + $host)' on line 5, col 1 90 if _v is not None: write(_filter(_v, rawExpr='$head("Zephir &mdash; " + $host)')) # from line 5, col 1. 91 write(''' 92 93 <SCRIPT LANGUAGE="JavaScript"> 94 <!-- 95 function clear() { 96 location.reload(false) 97 } 98 setTimeout ("clear()", 60000); 99 // --> 100 </SCRIPT> 101 102 <h1 id="title">''') 103 _v = VFFSL(SL,"description",True) # '$description' on line 16, col 16 104 if _v is not None: write(_filter(_v, rawExpr='$description')) # from line 16, col 16. 105 write('''</h1> 106 107 <div id="nav"> 108 ''') 109 if VFFSL(SL,"len",False)(VFFSL(SL,"manager.structure",True)) != 0: # generated from line 19, col 3 110 write(' <ol>\n') 111 if VFFSL(SL,"show_clients",True) == True: # generated from line 21, col 5 112 write(' <li><a href="/agents/">Clients</a></li>\n') 113 for section, agents in VFFSL(SL,"manager.structure",True): # generated from line 24, col 5 114 write(' <li><a href="#') 115 _v = VFFSL(SL,"section",True) # '$section' on line 25, col 19 116 if _v is not None: write(_filter(_v, rawExpr='$section')) # from line 25, col 19. 117 write('">') 118 _v = VFFSL(SL,"section",True) # '$section' on line 25, col 29 119 if _v is not None: write(_filter(_v, rawExpr='$section')) # from line 25, col 29. 120 write('</a></li>\n') 121 write(' <li><a href="/agents/') 122 _v = VFFSL(SL,"manager.client_name",True) # '$manager.client_name' on line 27, col 26 123 if _v is not None: write(_filter(_v, rawExpr='$manager.client_name')) # from line 27, col 26. 124 write('/bilan/">Bilan Mensuel</a></li>\n </ol>\n') 125 write('''</div> <!-- nav --> 126 127 <div id="content"> 128 ''') 129 t = SectionTmpl() 130 t.depth = 2 131 t.content = VFFSL(SL,"manager.structure",True) 132 t.manager = VFFSL(SL,"manager",True) 133 _v = VFFSL(SL,"str",False)(VFFSL(SL,"t",True)) # '$str($t)' on line 38, col 1 134 if _v is not None: write(_filter(_v, rawExpr='$str($t)')) # from line 38, col 1. 135 write(''' 136 </div> <!-- content --> 137 138 ''') 139 _v = VFFSL(SL,"foot",False)() # '$foot()' on line 41, col 1 140 if _v is not None: write(_filter(_v, rawExpr='$foot()')) # from line 41, col 1. 141 write('\n') 142 143 ######################################## 144 ## END - generated method body 145 146 return _dummyTrans and trans.response().getvalue() or ""
147 148 ################################################## 149 ## CHEETAH GENERATED ATTRIBUTES 150 151 152 _CHEETAH__instanceInitialized = False 153 154 _CHEETAH_version = __CHEETAH_version__ 155 156 _CHEETAH_versionTuple = __CHEETAH_versionTuple__ 157 158 _CHEETAH_genTime = __CHEETAH_genTime__ 159 160 _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__ 161 162 _CHEETAH_src = __CHEETAH_src__ 163 164 _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__ 165 166 _mainCheetahMethod_for_ManagerPageTmpl= 'respond'
167 168 ## END CLASS DEFINITION 169 170 if not hasattr(ManagerPageTmpl, '_initCheetahAttributes'): 171 templateAPIClass = getattr(ManagerPageTmpl, '_CHEETAH_templateClass', Template) 172 templateAPIClass._addCheetahPlumbingCodeToClass(ManagerPageTmpl) 173 174 175 # CHEETAH was developed by Tavis Rudd and Mike Orr 176 # with code, advice and input from many other volunteers. 177 # For more information visit http://www.CheetahTemplate.org/ 178 179 ################################################## 180 ## if run from command line: 181 if __name__ == '__main__': 182 from Cheetah.TemplateCmdLineIface import CmdLineIface 183 CmdLineIface(templateObj=ManagerPageTmpl()).run() 184