Changeset 1001 for trunk/packages
- Timestamp:
- Oct 2, 2008, 8:18:40 AM (16 years ago)
- Location:
- trunk/packages/sipb-xen-www/code
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-www/code/controls.py
r879 r1001 14 14 15 15 from invirt.config import structs as config 16 from invirt.database import Machine, Disk, Type, NIC, CDROM, ctx, meta16 from invirt.database import Machine, Disk, Type, NIC, CDROM, session, meta 17 17 18 18 # ... and stolen from xend/uuid.py -
trunk/packages/sipb-xen-www/code/main.py
r912 r1001 41 41 from getafsgroups import getAfsGroupMembers 42 42 from invirt import database 43 from invirt.database import Machine, CDROM, ctx, connect, MachineAccess, Type, Autoinstall43 from invirt.database import Machine, CDROM, session, connect, MachineAccess, Type, Autoinstall 44 44 from invirt.config import structs as config 45 45 -
trunk/packages/sipb-xen-www/code/templates/functions.tmpl
r864 r1001 21 21 #def cdromList($default="", $onchange=None) 22 22 #filter None 23 $databaseList(sorted($database.CDROM. select(), key=lambda x: x.description),23 $databaseList(sorted($database.CDROM.query(), key=lambda x: x.description), 24 24 default, onchange, 'cdrom', 'cdromlist', 'cdrom_id', 'description') 25 25 #end filter … … 28 28 #def autoList($default="", $onchange=None) 29 29 #filter None 30 $databaseList(sorted($database.Autoinstall. select(), key=lambda x: x.description),30 $databaseList(sorted($database.Autoinstall.query(), key=lambda x: x.description), 31 31 default, onchange, 'autoinstall', 'autoinstalllist', 'autoinstall_id', 'description') 32 32 #end filter -
trunk/packages/sipb-xen-www/code/validation.py
r879 r1001 79 79 if machine: 80 80 owner = machine.owner 81 return Machine. select_by(owner=owner)81 return Machine.query().filter_by(owner=owner) 82 82 83 83 def maxMemory(owner, g, machine=None, on=True): … … 111 111 else: 112 112 machine_id = None 113 disk_usage = Disk.query().filter_by(Disk.c.machine_id != machine_id, 114 owner=owner).sum(Disk.c.size) or 0 113 disk_usage = Disk.query().filter(Disk.c.machine_id != machine_id).\ 114 join('machine').\ 115 filter_by(owner=owner).sum(Disk.c.size) or 0 115 116 return min(MAX_DISK_SINGLE, MAX_DISK_TOTAL-disk_usage/1024.) 116 117 … … 118 119 machines = getMachinesByOwner(owner) 119 120 active_machines = [m for m in machines if m.name in g.xmlist_raw] 120 if len(machines) >= MAX_VMS_TOTAL:121 if machines.count() >= MAX_VMS_TOTAL: 121 122 return 'You have too many VMs to create a new one.' 122 123 if len(active_machines) >= MAX_VMS_ACTIVE: … … 270 271 if machine is not None and name == machine.name: 271 272 return None 272 if not Machine. select_by(name=name):273 if not Machine.query().filter_by(name=name): 273 274 if not validMachineName(name): 274 275 raise InvalidInput('name', name, 'You must provide a machine name. Max 63 chars, alnum plus \'-\', does not begin or end with \'-\'.') -
trunk/packages/sipb-xen-www/code/webcommon.py
r874 r1001 46 46 def getMachines(self): 47 47 if self.isadmin: 48 return Machine.query().join('acl'). select_by(48 return Machine.query().join('acl').filter_by( 49 49 database.or_(MachineAccess.c.user == self.username, 50 50 Machine.c.adminable == True)) 51 51 else: 52 return Machine.query().join('acl'). select_by(user=self.username)52 return Machine.query().join('acl').filter_by(user=self.username) 53 53 54 54 machines = cachedproperty(getMachines)
Note: See TracChangeset
for help on using the changeset viewer.