Help, admin, links at the top.
[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
24 ##################################################
25 ## MODULE CONSTANTS
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.0rc8'
35 __CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 8)
36 __CHEETAH_genTime__ = 1192082083.444865
37 __CHEETAH_genTimestamp__ = 'Thu Oct 11 01:54:43 2007'
38 __CHEETAH_src__ = 'skeleton.tmpl'
39 __CHEETAH_srcLastModified__ = 'Thu Oct 11 01:54:41 2007'
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 ## CLASSES
50
51 class skeleton(Template):
52
53     ##################################################
54     ## CHEETAH GENERATED METHODS
55
56
57     def __init__(self, *args, **KWs):
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
68     def respond(self, trans=None):
69
70
71
72         ## CHEETAH: main method generated for this template
73         if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
74             trans = self.transaction # is None unless self.awake() was called
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         ## START - generated method body
85         
86         write('''<html>
87 <head><title>''')
88         _v = VFFSL(SL,"title",True) # '$title' on line 2, col 14
89         if _v is not None: write(_filter(_v, rawExpr='$title')) # from line 2, col 14.
90         write('''</title>
91   <link href="static/favicon.ico" type="image/x-icon" rel="shortcut icon">
92   <link rel="stylesheet" href="static/style.css" type="text/css" />
93   <link rel="stylesheet" href="static/layout.css" type="text/css" media="screen" />
94   <script type="text/javascript">
95 var helpWin = null;
96 function closeWin(){
97 \tif (helpWin != null){
98 \t\tif(!helpWin.closed)
99 \t\t\thelpWin.close();
100 \t}
101 }
102
103 function helppopup(name){
104    closeWin()
105    helpWin = window.open("help?simple=true&subject="+encodeURIComponent(name), "Help",
106 "status, height = 300, width = 400");
107    if (window.focus){helpWin.focus();}
108    return false;
109 }
110 </script>
111 </head>
112 <body>
113 ''')
114         if not VFFSL(SL,"varExists",False)('simple') or not VFFSL(SL,"simple",True): # generated from line 25, col 1
115             write('''<p>[You are logged in as ''')
116             _v = VFFSL(SL,"user.username",True) # '$user.username' on line 26, col 26
117             if _v is not None: write(_filter(_v, rawExpr='$user.username')) # from line 26, col 26.
118             write('''.]</p>
119 <p><a href="list">List</a> 
120 ''')
121             if VFFSL(SL,"varExists",False)('machine'): # generated from line 28, col 1
122                 write('''<a href="info?machine_id=''')
123                 _v = VFFSL(SL,"machine.machine_id",True) # '$machine.machine_id' on line 29, col 26
124                 if _v is not None: write(_filter(_v, rawExpr='$machine.machine_id')) # from line 29, col 26.
125                 write('''">Info</a>
126 <a href="vnc?machine_id=''')
127                 _v = VFFSL(SL,"machine.machine_id",True) # '$machine.machine_id' on line 30, col 25
128                 if _v is not None: write(_filter(_v, rawExpr='$machine.machine_id')) # from line 30, col 25.
129                 write('''">Console</a>
130 ''')
131             write('''<a href="help">Help</a></p>
132 ''')
133         _v = VFFSL(SL,"body",True) # '$body' on line 34, col 1
134         if _v is not None: write(_filter(_v, rawExpr='$body')) # from line 34, col 1.
135         write('''
136 ''')
137         if not VFFSL(SL,"varExists",False)('simple') or not VFFSL(SL,"simple",True): # generated from line 35, col 1
138             write('''<hr />
139 Questions? Contact <a href="mailto:sipb-xen-dev@mit.edu">sipb-xen-dev@mit.edu</a>.
140 ''')
141         write('''</body>
142 </html>
143 ''')
144         
145         ########################################
146         ## END - generated method body
147         
148         return _dummyTrans and trans.response().getvalue() or ""
149         
150     ##################################################
151     ## CHEETAH GENERATED ATTRIBUTES
152
153
154     _CHEETAH__instanceInitialized = False
155
156     _CHEETAH_version = __CHEETAH_version__
157
158     _CHEETAH_versionTuple = __CHEETAH_versionTuple__
159
160     _CHEETAH_genTime = __CHEETAH_genTime__
161
162     _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
163
164     _CHEETAH_src = __CHEETAH_src__
165
166     _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
167
168     _mainCheetahMethod_for_skeleton= 'respond'
169
170 ## END CLASS DEFINITION
171
172 if not hasattr(skeleton, '_initCheetahAttributes'):
173     templateAPIClass = getattr(skeleton, '_CHEETAH_templateClass', Template)
174     templateAPIClass._addCheetahPlumbingCodeToClass(skeleton)
175
176
177 # CHEETAH was developed by Tavis Rudd and Mike Orr
178 # with code, advice and input from many other volunteers.
179 # For more information visit http://www.CheetahTemplate.org/
180
181 ##################################################
182 ## if run from command line:
183 if __name__ == '__main__':
184     from Cheetah.TemplateCmdLineIface import CmdLineIface
185     CmdLineIface(templateObj=skeleton()).run()
186
187