From e6be19efbc42125896ed5db29673fec32b09c72f Mon Sep 17 00:00:00 2001 From: Allan Saddi Date: Thu, 6 Apr 2006 23:05:05 +0000 Subject: Catch a strange FieldStorage case. --- ChangeLog | 5 +++++ flup/publisher.py | 29 +++++++++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae7a837..04867e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-04-06 Allan Saddi + + * Catch a strange FieldStorage case. Seen in production. + Not quite sure what causes it. + 2006-03-21 Allan Saddi * Add maxRequests option to PreforkServer. Patch provided by diff --git a/flup/publisher.py b/flup/publisher.py index 73a8b30..a0c6676 100644 --- a/flup/publisher.py +++ b/flup/publisher.py @@ -1,4 +1,4 @@ -# Copyright (c) 2002, 2005 Allan Saddi +# Copyright (c) 2002, 2005, 2006 Allan Saddi # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -85,19 +85,20 @@ class Request(object): environ=self._environ, keep_blank_values=1) # Collapse FieldStorage into a simple dict. - for field in form.list: - # Wrap uploaded files - if field.filename: - val = File(field) - else: - val = field.value - - # Add File/value to args, constructing a list if there are - # multiple values. - if self._form.has_key(field.name): - self._form[field.name].append(val) - else: - self._form[field.name] = [val] + if form.list is not None: + for field in form.list: + # Wrap uploaded files + if field.filename: + val = File(field) + else: + val = field.value + + # Add File/value to args, constructing a list if there are + # multiple values. + if self._form.has_key(field.name): + self._form[field.name].append(val) + else: + self._form[field.name] = [val] # Unwrap lists with a single item. for name,val in self._form.items(): -- cgit v1.2.1