the select box).
"""
def __init__(self, err_field, err_value, expl=None):
- super(InvalidInput, self).__init__(expl)
+ MyException.__init__(self, expl)
self.err_field = err_field
self.err_value = err_value
def testName(user, name, machine=None):
if Machine.select_by(name=name) == []:
return name
+ if name == machine.name:
+ return name
raise InvalidInput('name', name,
"Already taken")
contact = testContact(user, fields.getfirst('contact'))
hostname = testHostname(owner, fields.getfirst('hostname'),
machine)
- name = testName(user, fields.getfirst('name'))
+ name = testName(user, fields.getfirst('name'), machine)
oldname = machine.name
olddisk = {}
memory = fields.getfirst('memory')
if memory is not None:
memory = validMemory(user, memory, machine)
+ else:
+ memory = machine.memory
if memory != machine.memory:
machine.memory = memory
disksize = testDisk(user, fields.getfirst('disk'))
if disksize is not None:
disksize = validDisk(user, disksize, machine)
-
for disk in machine.disks:
disk.size = disksize
olddisk[disk.guest_device_name] = disk.size