Changeset 577 for trunk/packages
- Timestamp:
- Jun 2, 2008, 11:58:25 PM (16 years ago)
- Location:
- trunk/packages/sipb-xen-www/code
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-www/code/controls.py
r574 r577 98 98 transaction = ctx.current.create_transaction() 99 99 try: 100 validation.Validate(username, state, owner=owner, memory=memory, disksize=disksize/1024.)100 validation.Validate(username, state, name=name, owner=owner, memory=memory, disksize=disksize/1024.) 101 101 res = meta.engine.execute('select nextval(' 102 102 '\'"machines_machine_id_seq"\')') -
trunk/packages/sipb-xen-www/code/main.py
r576 r577 145 145 def parseCreate(username, state, fields): 146 146 kws = dict([(kw, fields.getfirst(kw)) for kw in 'name owner memory disksize vmtype cdrom clone_from'.split()]) 147 validate = validation.Validate(username, state, **kws)147 validate = validation.Validate(username, state, strict=True, **kws) 148 148 return dict(contact=username, name=validate.name, memory=validate.memory, 149 149 disksize=validate.disksize, owner=validate.owner, machine_type=validate.vmtype, … … 155 155 try: 156 156 parsed_fields = parseCreate(username, state, fields) 157 machine = controls.createVm(username, **parsed_fields)157 machine = controls.createVm(username, state, **parsed_fields) 158 158 except InvalidInput, err: 159 159 pass -
trunk/packages/sipb-xen-www/code/validation.py
r576 r577 20 20 def __init__(self, username, state, machine_id=None, name=None, owner=None, 21 21 admin=None, contact=None, memory=None, disksize=None, 22 vmtype=None, cdrom=None, clone_from=None ):22 vmtype=None, cdrom=None, clone_from=None, strict=False): 23 23 # XXX Successive quota checks aren't a good idea, since you 24 24 # can't necessarily change the locker and disk size at the 25 25 # same time. 26 26 created_new = (machine_id is None) 27 28 if strict: 29 if name is None: 30 raise InvalidInput('name', name, "You must provide a machine name.") 31 if memory is None: 32 raise InvalidInput('memory', memory, "You must provide a memory size.") 33 if disksize is None: 34 raise InvalidInput('disk', disksize, "You must provide a disk size.") 27 35 28 36 if machine_id is not None:
Note: See TracChangeset
for help on using the changeset viewer.