+ class MachineView(View):
+ # This is hairy. Fix when CherryPy 3.2 is out. (rename to
+ # _cp_dispatch, and parse the argument as a list instead of
+ # string
+
+ def __getattr__(self, name):
+ try:
+ machine_id = int(name)
+ cherrypy.request.params['machine_id'] = machine_id
+ return self
+ except ValueError:
+ return None
+
+ @cherrypy.expose
+ @cherrypy.tools.mako(filename="/info.mako")
+ def info(self, machine_id):
+ """Handler for info on a single VM."""
+ machine = validation.Validate(cherrypy.request.login, cherrypy.request.state, machine_id=machine_id).machine
+ d = infoDict(cherrypy.request.login, cherrypy.request.state, machine)
+ checkpoint.checkpoint('Got infodict')
+ return d
+ index = info
+
+ machine = MachineView()
+