"Cherry-pick" r2557 (Re-arrange the authz configuration.) to the
[invirt/packages/invirt-web.git] / code / controls.py
index c51a6ba..bbc9f8c 100644 (file)
@@ -208,9 +208,7 @@ def commandResult(username, state, command_name, machine_id, fields):
     start_time = 0
     machine = validation.Validate(username, state, machine_id=machine_id).machine
     action = command_name
-    cdrom = fields.get('cdrom')
-    if not cdrom:
-        cdrom = None
+    cdrom = fields.get('cdrom') or None
     if cdrom is not None and not CDROM.query().filter_by(cdrom_id=cdrom).one():
         raise CodeError("Invalid cdrom type '%s'" % cdrom)    
     if action not in "reboot create destroy shutdown delete".split(" "):