1
2
3
4
5
6
7
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
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.1454029
37 __CHEETAH_genTimestamp__ = 'Thu Jul 8 16:22:25 2010'
38 __CHEETAH_src__ = 'AgentTmpl.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
50
52
53
54
55
56
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
69
70
71
72
73 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
74 trans = self.transaction
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
85
86 write('''<!-- AgentTmpl #encoding utf-8 -->
87 ''')
88 if VFN(VFFSL(SL,"manager",True),"has_key",False)(VFFSL(SL,"name",True)):
89 s = VFN(VFFSL(SL,"manager",True)[VFFSL(SL,"name",True)],"last_status",True)
90 link = VFFSL(SL,"name",True)
91 if VFN(VFFSL(SL,"manager",True)[VFFSL(SL,"name",True)],"description",True) is not None and VFFSL(SL,"len",False)(VFN(VFFSL(SL,"manager",True)[VFFSL(SL,"name",True)],"description",True)) != 0:
92 link = VFN(VFFSL(SL,"manager",True)[VFFSL(SL,"name",True)],"description",True)
93 else:
94 link = VFN(VFFSL(SL,"manager",True)[VFFSL(SL,"name",True)],"name",True)
95 write(''' <a href="/agents/''')
96 _v = VFFSL(SL,"manager.client_name",True)
97 if _v is not None: write(_filter(_v, rawExpr='$manager.client_name'))
98 write('''/''')
99 _v = VFFSL(SL,"name",True)
100 if _v is not None: write(_filter(_v, rawExpr='$name'))
101 write('''/">''')
102 _v = VFFSL(SL,"link",True)
103 if _v is not None: write(_filter(_v, rawExpr='$link'))
104 write('''</a>
105 [<span class="status-''')
106 _v = VFFSL(SL,"s.level",True)
107 if _v is not None: write(_filter(_v, rawExpr='$s.level'))
108 write('''">''')
109 _v = VFFSL(SL,"str",False)(VFFSL(SL,"s",True))
110 if _v is not None: write(_filter(_v, rawExpr='$str($s)'))
111 write('''</span>]
112 ''')
113 else:
114 write(''' <span class="invalid" title="Agent non charg\xc3\xa9">''')
115 _v = VFFSL(SL,"name",True)
116 if _v is not None: write(_filter(_v, rawExpr='$name'))
117 write('''</span>
118 ''')
119
120
121
122
123 return _dummyTrans and trans.response().getvalue() or ""
124
125
126
127
128
129 _CHEETAH__instanceInitialized = False
130
131 _CHEETAH_version = __CHEETAH_version__
132
133 _CHEETAH_versionTuple = __CHEETAH_versionTuple__
134
135 _CHEETAH_genTime = __CHEETAH_genTime__
136
137 _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
138
139 _CHEETAH_src = __CHEETAH_src__
140
141 _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
142
143 _mainCheetahMethod_for_AgentTmpl= 'respond'
144
145
146
147 if not hasattr(AgentTmpl, '_initCheetahAttributes'):
148 templateAPIClass = getattr(AgentTmpl, '_CHEETAH_templateClass', Template)
149 templateAPIClass._addCheetahPlumbingCodeToClass(AgentTmpl)
150
151
152
153
154
155
156
157
158 if __name__ == '__main__':
159 from Cheetah.TemplateCmdLineIface import CmdLineIface
160 CmdLineIface(templateObj=AgentTmpl()).run()
161