From: Mark Wooding Date: Fri, 23 May 2014 17:22:44 +0000 (+0100) Subject: cgi.py: Don't crash if we have three values for a parameter. X-Git-Tag: 1.1.0~13 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/chopwood/commitdiff_plain/9d6ec9ac56508d35a0f66eb6747782dbc996735a?ds=sidebyside cgi.py: Don't crash if we have three values for a parameter. The first time we see a parameter, we add it to `PARAMDICT'. The second time, we remove it again because it's multivalued. The third time, we try to remove it again, and that fails because it's already gone. --- diff --git a/cgi.py b/cgi.py index cfa26f7..69b9038 100644 --- a/cgi.py +++ b/cgi.py @@ -419,7 +419,8 @@ def cgiparse(): else: PARAM.append((k, v)) if k in seen: - del PARAMDICT[k] + try: del PARAMDICT[k] + except KeyError: pass else: PARAMDICT[k] = v seen.add(k)