Package zephir :: Package monitor :: Package agentmanager :: Package templates :: Module SectionTmpl
[hide private]
[frames] | no frames]

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

  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.AgentTmpl import AgentTmpl 
 24   
 25  ################################################## 
 26  ## MODULE CONSTANTS 
 27  try: 
 28      True, False 
 29  except NameError: 
 30      True, False = (1==1), (1==0) 
 31  VFFSL=valueFromFrameOrSearchList 
 32  VFSL=valueFromSearchList 
 33  VFN=valueForName 
 34  currentTime=time.time 
 35  __CHEETAH_version__ = '2.0rc7' 
 36  __CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 7) 
 37  __CHEETAH_genTime__ = 1190887608.5551319 
 38  __CHEETAH_genTimestamp__ = 'Thu Sep 27 12:06:48 2007' 
 39  __CHEETAH_src__ = 'SectionTmpl.tmpl' 
 40  __CHEETAH_srcLastModified__ = 'Tue Jan 23 10:43:33 2007' 
 41  __CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine' 
 42   
 43  if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple: 
 44      raise AssertionError( 
 45        'This template was compiled with Cheetah version' 
 46        ' %s. Templates compiled before version %s must be recompiled.'%( 
 47           __CHEETAH_version__, RequiredCheetahVersion)) 
 48   
 49  ################################################## 
 50  ## CLASSES 
 51   
52 -class SectionTmpl(Template):
53 54 ################################################## 55 ## CHEETAH GENERATED METHODS 56 57
58 - def __init__(self, *args, **KWs):
59 60 Template.__init__(self, *args, **KWs) 61 if not self._CHEETAH__instanceInitialized: 62 cheetahKWArgs = {} 63 allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split() 64 for k,v in KWs.items(): 65 if k in allowedKWs: cheetahKWArgs[k] = v 66 self._initCheetahInstance(**cheetahKWArgs)
67 68
69 - def respond(self, trans=None):
70 71 72 73 ## CHEETAH: main method generated for this template 74 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)): 75 trans = self.transaction # is None unless self.awake() was called 76 if not trans: 77 trans = DummyTransaction() 78 _dummyTrans = True 79 else: _dummyTrans = False 80 write = trans.response().write 81 SL = self._CHEETAH__searchList 82 _filter = self._CHEETAH__currentFilter 83 84 ######################################## 85 ## START - generated method body 86 87 write('''<!-- SectionTmpl #encoding utf-8 --> 88 89 90 ''') 91 for subtitle, agents in VFFSL(SL,"content",True): # generated from line 5, col 1 92 if VFFSL(SL,"subtitle",True) is not None: # generated from line 6, col 3 93 write(' <h') 94 _v = VFFSL(SL,"depth",True) 95 if _v is not None: write(_filter(_v)) 96 write(' id="') 97 _v = VFFSL(SL,"subtitle",True) # '$subtitle' on line 7, col 25 98 if _v is not None: write(_filter(_v, rawExpr='$subtitle')) # from line 7, col 25. 99 write('">') 100 _v = VFFSL(SL,"subtitle",True) # '$subtitle' on line 7, col 36 101 if _v is not None: write(_filter(_v, rawExpr='$subtitle')) # from line 7, col 36. 102 write('</h') 103 _v = VFFSL(SL,"depth",True) 104 if _v is not None: write(_filter(_v)) 105 write('>\n') 106 write(' <ul>\n') 107 for name in VFFSL(SL,"agents",True): # generated from line 10, col 3 108 write(' <li>') 109 _v = VFFSL(SL,"str",False)(AgentTmpl(searchList=[{'name':VFFSL(SL,"name",True), 'manager':VFFSL(SL,"manager",True)}])) # "$str(AgentTmpl(searchList=[{'name':$name, 'manager':$manager}]))" on line 11, col 9 110 if _v is not None: write(_filter(_v, rawExpr="$str(AgentTmpl(searchList=[{'name':$name, 'manager':$manager}]))")) # from line 11, col 9. 111 write('</li>\n') 112 write(' </ul>\n') 113 114 ######################################## 115 ## END - generated method body 116 117 return _dummyTrans and trans.response().getvalue() or ""
118 119 ################################################## 120 ## CHEETAH GENERATED ATTRIBUTES 121 122 123 _CHEETAH__instanceInitialized = False 124 125 _CHEETAH_version = __CHEETAH_version__ 126 127 _CHEETAH_versionTuple = __CHEETAH_versionTuple__ 128 129 _CHEETAH_genTime = __CHEETAH_genTime__ 130 131 _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__ 132 133 _CHEETAH_src = __CHEETAH_src__ 134 135 _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__ 136 137 _mainCheetahMethod_for_SectionTmpl= 'respond'
138 139 ## END CLASS DEFINITION 140 141 if not hasattr(SectionTmpl, '_initCheetahAttributes'): 142 templateAPIClass = getattr(SectionTmpl, '_CHEETAH_templateClass', Template) 143 templateAPIClass._addCheetahPlumbingCodeToClass(SectionTmpl) 144 145 146 # CHEETAH was developed by Tavis Rudd and Mike Orr 147 # with code, advice and input from many other volunteers. 148 # For more information visit http://www.CheetahTemplate.org/ 149 150 ################################################## 151 ## if run from command line: 152 if __name__ == '__main__': 153 from Cheetah.TemplateCmdLineIface import CmdLineIface 154 CmdLineIface(templateObj=SectionTmpl()).run() 155