From 36c143099b46d2bf77569d4f1d660505ed9d37d6 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Thu, 29 Oct 2009 01:36:42 -0400 Subject: [PATCH] main.py: FieldStorage is history, so revert to sugared getitem. svn path=/package_branches/invirt-web/cherrypy-rebased/; revision=2707 --- code/main.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/code/main.py b/code/main.py index f89763c..c4eff65 100755 --- a/code/main.py +++ b/code/main.py @@ -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 -- 1.7.9.5