Removed the Javascript, since I realized that
[invirt/packages/invirt-web.git] / templates / skeleton.py
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 functions import functions
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.0rc8'
36 __CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 8)
37 __CHEETAH_genTime__ = 1192889324.1837969
38 __CHEETAH_genTimestamp__ = 'Sat Oct 20 10:08:44 2007'
39 __CHEETAH_src__ = 'skeleton.tmpl'
40 __CHEETAH_srcLastModified__ = 'Sat Oct 20 10:08:36 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 skeleton(functions):
53
54     ##################################################
55     ## CHEETAH GENERATED METHODS
56
57
58     def __init__(self, *args, **KWs):
59
60         functions.__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 full_body(self, **KWS):
70
71
72
73         ## CHEETAH: generated from #def full_body at line 4, col 1.
74         trans = KWS.get("trans")
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('''<!DOCTYPE html
89 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
90 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
91 <html>
92 <head><title>''')
93         _v = VFFSL(SL,"title",True) # '$title' on line 9, col 14
94         if _v is not None: write(_filter(_v, rawExpr='$title')) # from line 9, col 14.
95         write('''</title>
96   <link href="static/favicon.ico" type="image/x-icon" rel="shortcut icon">
97   <link rel="stylesheet" href="static/style.css" type="text/css" />
98   <link rel="stylesheet" href="static/layout.css" type="text/css" media="screen" />
99   <script type="text/javascript" src="static/prototype.js"></script>
100   <script type="text/javascript">
101 var helpWin = null;
102 function closeWin(){
103 \tif (helpWin != null){
104 \t\tif(!helpWin.closed)
105 \t\t\thelpWin.close();
106 \t}
107 }
108
109 function helppopup(name){
110    closeWin()
111    helpWin = window.open("help?simple=true&subject="+encodeURIComponent(name), "Help",
112 "status, height = 300, width = 400");
113    if (window.focus){helpWin.focus();}
114    return false;
115 }
116 </script>
117 </head>
118 <body id="body">
119
120 <div id="err">
121 ''')
122         if VFFSL(SL,"varExists",False)('error_text'): # generated from line 35, col 1
123             write('''<p>STDERR:</p><pre>''')
124             _v = VFFSL(SL,"error_text",True) # '$error_text' on line 36, col 20
125             if _v is not None: write(_filter(_v, rawExpr='$error_text')) # from line 36, col 20.
126             write('''</pre>
127 ''')
128         write('''</div>
129
130 ''')
131         if not VFFSL(SL,"varExists",False)('simple') or not VFFSL(SL,"simple",True): # generated from line 40, col 1
132             write('''<p>[You are logged in as ''')
133             _v = VFFSL(SL,"user.username",True) # '$user.username' on line 41, col 26
134             if _v is not None: write(_filter(_v, rawExpr='$user.username')) # from line 41, col 26.
135             write('''.]</p>
136
137 <div class="navigation">
138 <p><a href="list">List</a> 
139 ''')
140             if VFFSL(SL,"varExists",False)('machine'): # generated from line 45, col 1
141                 write('''<a href="info?machine_id=''')
142                 _v = VFFSL(SL,"machine.machine_id",True) # '$machine.machine_id' on line 46, col 26
143                 if _v is not None: write(_filter(_v, rawExpr='$machine.machine_id')) # from line 46, col 26.
144                 write('''">Info</a>
145 <a href="vnc?machine_id=''')
146                 _v = VFFSL(SL,"machine.machine_id",True) # '$machine.machine_id' on line 47, col 25
147                 if _v is not None: write(_filter(_v, rawExpr='$machine.machine_id')) # from line 47, col 25.
148                 write('''">Console</a>
149 ''')
150             write('''<a href="help">Help</a></p>
151 ''')
152         write('''</div>
153
154 <div id="loadingnotice" class="loadingnotice">LOADING</div>
155 <div id="result" class="result">
156 ''')
157         if VFFSL(SL,"varExists",False)('result'): # generated from line 55, col 1
158             _v = VFFSL(SL,"result",True) # '$result' on line 56, col 1
159             if _v is not None: write(_filter(_v, rawExpr='$result')) # from line 56, col 1.
160             write('''
161 ''')
162         write('''</div>
163
164 ''')
165         _v = VFFSL(SL,"body",True) # '$body' on line 60, col 1
166         if _v is not None: write(_filter(_v, rawExpr='$body')) # from line 60, col 1.
167         write('''
168 ''')
169         if not VFFSL(SL,"varExists",False)('simple') or not VFFSL(SL,"simple",True): # generated from line 61, col 1
170             write('''<hr />
171 Questions? Contact <a href="mailto:sipb-xen-dev@mit.edu">sipb-xen-dev@mit.edu</a>.
172 ''')
173         write('''</body>
174 </html>
175 ''')
176         
177         ########################################
178         ## END - generated method body
179         
180         return _dummyTrans and trans.response().getvalue() or ""
181         
182
183     def writeBody(self, **KWS):
184
185
186
187         ## CHEETAH: main method generated for this template
188         trans = KWS.get("trans")
189         if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
190             trans = self.transaction # is None unless self.awake() was called
191         if not trans:
192             trans = DummyTransaction()
193             _dummyTrans = True
194         else: _dummyTrans = False
195         write = trans.response().write
196         SL = self._CHEETAH__searchList
197         _filter = self._CHEETAH__currentFilter
198         
199         ########################################
200         ## START - generated method body
201         
202         write('''
203 ''')
204         
205         ########################################
206         ## END - generated method body
207         
208         return _dummyTrans and trans.response().getvalue() or ""
209         
210     ##################################################
211     ## CHEETAH GENERATED ATTRIBUTES
212
213
214     _CHEETAH__instanceInitialized = False
215
216     _CHEETAH_version = __CHEETAH_version__
217
218     _CHEETAH_versionTuple = __CHEETAH_versionTuple__
219
220     _CHEETAH_genTime = __CHEETAH_genTime__
221
222     _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
223
224     _CHEETAH_src = __CHEETAH_src__
225
226     _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
227
228     _mainCheetahMethod_for_skeleton= 'writeBody'
229
230 ## END CLASS DEFINITION
231
232 if not hasattr(skeleton, '_initCheetahAttributes'):
233     templateAPIClass = getattr(skeleton, '_CHEETAH_templateClass', Template)
234     templateAPIClass._addCheetahPlumbingCodeToClass(skeleton)
235
236
237 # CHEETAH was developed by Tavis Rudd and Mike Orr
238 # with code, advice and input from many other volunteers.
239 # For more information visit http://www.CheetahTemplate.org/
240
241 ##################################################
242 ## if run from command line:
243 if __name__ == '__main__':
244     from Cheetah.TemplateCmdLineIface import CmdLineIface
245     CmdLineIface(templateObj=skeleton()).run()
246
247