source: trunk/web/templates/skeleton.py @ 206

Last change on this file since 206 was 206, checked in by ecprice, 17 years ago

(Forget to make this to test it)

File size: 9.0 KB
Line 
1#!/usr/bin/env python
2
3
4
5
6##################################################
7## DEPENDENCIES
8import sys
9import os
10import os.path
11from os.path import getmtime, exists
12import time
13import types
14import __builtin__
15from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
16from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
17from Cheetah.Template import Template
18from Cheetah.DummyTransaction import DummyTransaction
19from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
20from Cheetah.CacheRegion import CacheRegion
21import Cheetah.Filters as Filters
22import Cheetah.ErrorCatchers as ErrorCatchers
23from functions import functions
24
25##################################################
26## MODULE CONSTANTS
27try:
28    True, False
29except NameError:
30    True, False = (1==1), (1==0)
31VFFSL=valueFromFrameOrSearchList
32VFSL=valueFromSearchList
33VFN=valueForName
34currentTime=time.time
35__CHEETAH_version__ = '2.0rc7'
36__CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 7)
37__CHEETAH_genTime__ = 1192883610.434917
38__CHEETAH_genTimestamp__ = 'Sat Oct 20 08:33:30 2007'
39__CHEETAH_src__ = 'skeleton.tmpl'
40__CHEETAH_srcLastModified__ = 'Sat Oct 20 08:33:05 2007'
41__CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
42
43if __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
52class 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
89PUBLIC "-//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">
101var helpWin = null;
102function closeWin(){
103        if (helpWin != null){
104                if(!helpWin.closed)
105                        helpWin.close();
106        }
107}
108
109function 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
117Ajax.Responders.register({
118  onCreate: function(){
119    if (Ajax.activeRequestCount > 0) {
120       document.getElementById("loadingnotice").style.display = 'block';
121    }
122  },
123  onComplete: function(){
124    if (Ajax.activeRequestCount == 0) {
125      document.getElementById("loadingnotice").style.display = 'none';
126    }
127  }
128});
129function replaceFunc(transport) {
130  try {
131    d = transport.responseText.evalJSON();
132  } catch (e) {
133    $('body').innerHTML = '<pre>'+transport.responseText+'</pre>'
134    return;
135  }
136  for(key in d) {
137    $(key).innerHTML = d[key];
138  }
139}
140
141function jsFormSubmit(location, elt){
142  new Ajax.Request(location, {method: 'post',
143  parameters: Form.serialize(elt)+'&js=true',
144  onSuccess: replaceFunc,
145  onComplete: function() {Form.enable(elt);}
146  });
147  Form.disable(elt);
148  return false;
149}
150
151function rowFormSubmit(elt, retpage){
152  new Ajax.Request('command', {method: 'post',
153  parameters: Form.serialize(elt)+'&js='+retpage,
154  onSuccess: replaceFunc
155  });
156  return false;
157}
158
159window.onload = function (){
160  //Fix bug with disabled elements
161  $$('form').each(Form.enable);
162}
163
164</script>
165</head>
166<body id="body">
167
168<div id="err">
169''')
170        if VFFSL(SL,"varExists",False)('error_text'): # generated from line 83, col 1
171            write('<p>STDERR:</p><pre>')
172            _v = VFFSL(SL,"error_text",True) # '$error_text' on line 84, col 20
173            if _v is not None: write(_filter(_v, rawExpr='$error_text')) # from line 84, col 20.
174            write('</pre>\n')
175        write('</div>\n\n')
176        if not VFFSL(SL,"varExists",False)('simple') or not VFFSL(SL,"simple",True): # generated from line 88, col 1
177            write('<p>[You are logged in as ')
178            _v = VFFSL(SL,"user.username",True) # '$user.username' on line 89, col 26
179            if _v is not None: write(_filter(_v, rawExpr='$user.username')) # from line 89, col 26.
180            write('''.]</p>
181
182<div class="navigation">
183<p><a href="list">List</a> 
184''')
185            if VFFSL(SL,"varExists",False)('machine'): # generated from line 93, col 1
186                write('<a href="info?machine_id=')
187                _v = VFFSL(SL,"machine.machine_id",True) # '$machine.machine_id' on line 94, col 26
188                if _v is not None: write(_filter(_v, rawExpr='$machine.machine_id')) # from line 94, col 26.
189                write('">Info</a>\n<a href="vnc?machine_id=')
190                _v = VFFSL(SL,"machine.machine_id",True) # '$machine.machine_id' on line 95, col 25
191                if _v is not None: write(_filter(_v, rawExpr='$machine.machine_id')) # from line 95, col 25.
192                write('">Console</a>\n')
193            write('<a href="help">Help</a></p>\n')
194        write('''</div>
195
196<div id="loadingnotice" class="loadingnotice">LOADING</div>
197<div id="result" class="result"></div>
198
199''')
200        _v = VFFSL(SL,"body",True) # '$body' on line 104, col 1
201        if _v is not None: write(_filter(_v, rawExpr='$body')) # from line 104, col 1.
202        write('\n')
203        if not VFFSL(SL,"varExists",False)('simple') or not VFFSL(SL,"simple",True): # generated from line 105, col 1
204            write('<hr />\nQuestions? Contact <a href="mailto:sipb-xen-dev@mit.edu">sipb-xen-dev@mit.edu</a>.\n')
205        write('</body>\n</html>\n')
206       
207        ########################################
208        ## END - generated method body
209       
210        return _dummyTrans and trans.response().getvalue() or ""
211       
212
213    def writeBody(self, **KWS):
214
215
216
217        ## CHEETAH: main method generated for this template
218        trans = KWS.get("trans")
219        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
220            trans = self.transaction # is None unless self.awake() was called
221        if not trans:
222            trans = DummyTransaction()
223            _dummyTrans = True
224        else: _dummyTrans = False
225        write = trans.response().write
226        SL = self._CHEETAH__searchList
227        _filter = self._CHEETAH__currentFilter
228       
229        ########################################
230        ## START - generated method body
231       
232        write('\n')
233       
234        ########################################
235        ## END - generated method body
236       
237        return _dummyTrans and trans.response().getvalue() or ""
238       
239    ##################################################
240    ## CHEETAH GENERATED ATTRIBUTES
241
242
243    _CHEETAH__instanceInitialized = False
244
245    _CHEETAH_version = __CHEETAH_version__
246
247    _CHEETAH_versionTuple = __CHEETAH_versionTuple__
248
249    _CHEETAH_genTime = __CHEETAH_genTime__
250
251    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
252
253    _CHEETAH_src = __CHEETAH_src__
254
255    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
256
257    _mainCheetahMethod_for_skeleton= 'writeBody'
258
259## END CLASS DEFINITION
260
261if not hasattr(skeleton, '_initCheetahAttributes'):
262    templateAPIClass = getattr(skeleton, '_CHEETAH_templateClass', Template)
263    templateAPIClass._addCheetahPlumbingCodeToClass(skeleton)
264
265
266# CHEETAH was developed by Tavis Rudd and Mike Orr
267# with code, advice and input from many other volunteers.
268# For more information visit http://www.CheetahTemplate.org/
269
270##################################################
271## if run from command line:
272if __name__ == '__main__':
273    from Cheetah.TemplateCmdLineIface import CmdLineIface
274    CmdLineIface(templateObj=skeleton()).run()
275
276
Note: See TracBrowser for help on using the repository browser.