Changeset 2413 for package_branches
- Timestamp:
- Aug 9, 2009, 6:45:36 PM (15 years ago)
- Location:
- package_branches/invirt-web/cherrypy/code
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
package_branches/invirt-web/cherrypy/code/main.py
r2412 r2413 66 66 return d 67 67 index=list 68 69 @cherrypy.expose70 @cherrypy.tools.mako(filename="/info.mako")71 def info(self, machine_id):72 """Handler for info on a single VM."""73 machine = validation.Validate(cherrypy.request.login, cherrypy.request.state, machine_id=machine_id).machine74 d = infoDict(cherrypy.request.login, cherrypy.request.state, machine)75 checkpoint.checkpoint('Got infodict')76 return d77 68 78 69 @cherrypy.expose … … 159 150 return {'request': cherrypy.request, 'kwargs': kwargs} 160 151 helloworld._cp_config['tools.require_login.on'] = False 152 153 class MachineView(View): 154 # This is hairy. Fix when CherryPy 3.2 is out. (rename to 155 # _cp_dispatch, and parse the argument as a list instead of 156 # string 157 158 def __getattr__(self, name): 159 try: 160 machine_id = int(name) 161 cherrypy.request.params['machine_id'] = machine_id 162 return self 163 except ValueError: 164 return None 165 166 @cherrypy.expose 167 @cherrypy.tools.mako(filename="/info.mako") 168 def info(self, machine_id): 169 """Handler for info on a single VM.""" 170 machine = validation.Validate(cherrypy.request.login, cherrypy.request.state, machine_id=machine_id).machine 171 d = infoDict(cherrypy.request.login, cherrypy.request.state, machine) 172 checkpoint.checkpoint('Got infodict') 173 return d 174 index = info 175 176 machine = MachineView() 161 177 162 178 def pathSplit(path): -
package_branches/invirt-web/cherrypy/code/templates/info.mako
r2411 r2413 22 22 on Athena. <a href="https://xvm.scripts.mit.edu/wiki/SerialConsole">(more info)</a> 23 23 % elif has_vnc: 24 <strong><a href=" vnc?machine_id=${machine.machine_id}">Get Console</a></strong>24 <strong><a href="machine/${machine.machine_id}/vnc">Get Console</a></strong> 25 25 % else: 26 26 VNC console not enabled; still booting? -
package_branches/invirt-web/cherrypy/code/templates/list.mako
r2412 r2413 96 96 </form> 97 97 </td> 98 <td><a href=" info?machine_id=${machine.machine_id}">${machine.name}</a></td>98 <td><a href="machine/${machine.machine_id}">${machine.name}</a></td> 99 99 <td>${machine.memory}M</td> 100 100 <td>${machine.owner}</td> … … 112 112 <td>\ 113 113 % if has_vnc[machine] == True: 114 <a href=" vnc?machine_id=${machine.machine_id}">Console</a>\114 <a href="machine/${machine.machine_id}/vnc">Console</a>\ 115 115 % elif has_vnc[machine] == 'ParaVM': 116 116 ParaVM${self.fn.helppopup("ParaVM Console")} -
package_branches/invirt-web/cherrypy/code/templates/skeleton.mako
r2410 r2413 6 6 <html> 7 7 <head><title>${self.title()} — XVM</title> 8 <base href="${cherrypy.request.base}" /> 8 9 <link href="static/favicon.ico" type="image/x-icon" rel="shortcut icon"> 9 10 <link rel="stylesheet" href="static/style.css" type="text/css" /> … … 54 55 <li><a href="list">List</a></li> 55 56 % if machine: 56 <li><a href=" info?machine_id=${machine.machine_id}">Info</a></li>57 <li><a href=" vnc?machine_id=${machine.machine_id}">Console</a></li>57 <li><a href="machine/${machine.machine_id}">Info</a></li> 58 <li><a href="machine/${machine.machine_id}/vnc">Console</a></li> 58 59 % endif 59 60 <li><a href="help">Help</a></li>
Note: See TracChangeset
for help on using the changeset viewer.