Hi, Christoph. I'm not in a rush, so whenever you are done with vacation, here are the relevant parts (complete with inane comments):
# Webware 1.1.1, HTTPRequest.py, Lines 118-133 ############################## if fieldItems: for value in fieldItems: fields.setdefault(value.name, []).append(value) getValue = attrgetter('value') for key, value in fields.iteritems(): if len(value) > 1: value = map(getValue, value) else: value = value[0] if value.filename: if debug: print "Uploaded file found:", value.filename else: value = value.value fields[key] = value self._fieldStorage, self._fields = fieldStorage, fields # My proposed changes, starting Line 118 ############################## if fieldItems: for value in fieldItems: fields.setdefault(value.name, []).append(value) getValue = attrgetter('value') for key, value in fields.iteritems(): # IMPORTANT! value here is *always* a list, but it may contain only 1 member. # Are there multiple values for same key in the form? # This could be series of date pulldowns, or multiple file uploads. if len(value) > 1: # Analyze members of this list, set flag as appropriate IS_UPLOADS = False for listitem in value: try: if listitem.filename: # True for an uploaded file IS_UPLOADS = True except AttributeError: # [str].filename throws this pass # Check flag if IS_UPLOADS: # The existing list of FieldStorage objects is exactly what we want, so we alter nothing here. pass else: # Append the regular strings to the key's list. value = map(getValue, value) else: # Only one value for this key value = value[0] # Now, is this an upload? try: if value.filename: if debug: print "Uploaded file found:", value.filename else: value = value.value except AttributeError: # [str].filename throws this value = value.value fields[key] = value self._fieldStorage, self._fields = fieldStorage, fields Enjoy your holiday! Thanks, -Gary > On May 28, 2015, at 11:56, Christoph Zwerschke <c...@online.de> wrote: > > Hi Gary, > > thanks for the suggestion. I'm still maintaining Webware and will look > into any suggestion made here, though it may take some time (currently > on vacation). > > You can also post patches and requests to > http://sourceforge.net/p/webware/feature-requests/ > > -- Christoph > > ------------------------------------------------------------------------------ > _______________________________________________ > Webware-devel mailing list > Webware-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/webware-devel ------------------------------------------------------------------------------ _______________________________________________ Webware-devel mailing list Webware-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-devel