From: Eric Price Date: Tue, 22 Apr 2008 02:50:54 +0000 (-0400) Subject: Support autoinstalls table for creation list. X-Git-Tag: sipb-xen-www/3.4~25 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/b812ecb815635726dca92b6c3725ac0a4bb86ab6?hp=96d25596909648779ec4703abb25f489a33ca4aa Support autoinstalls table for creation list. svn path=/trunk/packages/sipb-xen-www/; revision=443 --- diff --git a/code/main.py b/code/main.py index f1ff5ac..3fe04d5 100755 --- a/code/main.py +++ b/code/main.py @@ -37,7 +37,7 @@ sys.path.append('/home/ecprice/.local/lib/python2.5/site-packages') import templates from Cheetah.Template import Template import sipb_xen_database -from sipb_xen_database import Machine, CDROM, ctx, connect, MachineAccess, Type +from sipb_xen_database import Machine, CDROM, ctx, connect, MachineAccess, Type, Autoinstall import validation from webcommon import InvalidInput, CodeError, g import controls @@ -98,6 +98,7 @@ class Defaults: memory = 256 disk = 4.0 cdrom = '' + autoinstall = '' name = '' def __init__(self, max_memory=None, max_disk=None, **kws): self.type = Type.get('linux-hvm') @@ -221,8 +222,7 @@ def getListDict(user): defaults=defaults, machines=machines, has_vnc=has_vnc, - uptimes=g.uptimes, - cdroms=CDROM.select()) + uptimes=g.uptimes) return d def listVms(user, fields): @@ -571,7 +571,6 @@ def infoDict(user, machine): defaults.disk = "%0.2f" % (machine.disks[0].size/1024.) checkpoint.checkpoint('Got defaults') d = dict(user=user, - cdroms=CDROM.select(), on=status is not None, machine=machine, defaults=defaults, diff --git a/code/templates/functions.tmpl b/code/templates/functions.tmpl index a746145..0854e6f 100644 --- a/code/templates/functions.tmpl +++ b/code/templates/functions.tmpl @@ -1,18 +1,33 @@ -#def cdromList($cdroms, $default="") - - #for $cdrom in $cdroms + #for $item in $lst #end for #end def +#def cdromList($default="", $onchange=None) +$databaseList(sorted($sipb_xen_database.CDROM.select(), key=lambda x: x.description), + default, onchange, 'cdrom', 'cdromlist', 'cdrom_id', 'description') +#end def + +#def autoList($default="", $onchange=None) +$databaseList(sorted($sipb_xen_database.Autoinstall.select(), key=lambda x: x.description), + default, onchange, 'autoinstall', 'autoinstalllist', 'autoinstall_id', 'description') +## $databaseList(autos, default, onchange, 'autoinstall', 'autoinstalllist', 'autoinstall_id', 'description') +#end def + #def vmTypeList($default=None) #for $vmtype in sorted($sipb_xen_database.Type.select(), key=lambda x: x.description)