def _get_instance_type(self, post): if post['instance_type.id'].isdigit(): id = int(post['instance_type.id']) else: id = post['instance_type.id'] return InstanceTypes.first(id=str(id))
def index(self): user_id = cherrypy.session.get('user.id') vms = VirtualMachines.find(user_id=user_id) env = dict( virtual_machines=vms, images=Images.all(), instance_types=InstanceTypes.all() ) return self.render("virtual_machines/index.html", self.crumbs, **env)