main.py: FieldStorage is history, so revert to sugared getitem.
authorGreg Price <price@mit.edu>
Thu, 29 Oct 2009 05:36:42 +0000 (01:36 -0400)
committerGreg Price <price@mit.edu>
Thu, 29 Oct 2009 05:36:42 +0000 (01:36 -0400)
svn path=/package_branches/invirt-web/cherrypy-rebased/; revision=2707

code/main.py

index f89763c..c4eff65 100755 (executable)
@@ -199,9 +199,9 @@ console will suffer artifacts.
     help._cp_config['tools.require_login.on'] = False
 
     def parseCreate(self, fields):
-        kws = dict([(kw, fields.get(kw)) for kw in
+        kws = dict([(kw, fields[kw]) for kw in
          'name description owner memory disksize vmtype cdrom autoinstall'.split()
-                    if fields.get(kw)])
+                    if fields[kw]])
         validate = validation.Validate(cherrypy.request.login,
                                        cherrypy.request.state,
                                        strict=True, **kws)
@@ -229,8 +229,8 @@ console will suffer artifacts.
         d = getListDict(cherrypy.request.login, cherrypy.request.state)
         d['err'] = err
         if err:
-            for field in fields.keys():
-                setattr(d['defaults'], field, fields.get(field))
+            for field, value in fields.items():
+                setattr(d['defaults'], field, value))
         else:
             d['new_machine'] = parsed_fields['name']
         return d
@@ -294,8 +294,8 @@ console will suffer artifacts.
                                  cherrypy.request.state, machine)
             info_dict['err'] = err
             if err:
-                for field in fields.keys():
-                    setattr(info_dict['defaults'], field, fields.get(field))
+                for field, value in fields.items():
+                    setattr(info_dict['defaults'], field, value)
             info_dict['result'] = result
             return info_dict
 
@@ -527,9 +527,9 @@ def modifyDict(username, state, machine_id, fields):
     olddisk = {}
     session.begin()
     try:
-        kws = dict([(kw, fields.get(kw)) for kw in
+        kws = dict([(kw, fields[kw]) for kw in
          'owner admin contact name description memory vmtype disksize'.split()
-                    if fields.get(kw)])
+                    if fields[kw]])
         kws['machine_id'] = machine_id
         validate = validation.Validate(username, state, **kws)
         machine = validate.machine