Description

Trying to upload an attachment gives a

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

at request.py line 853:

if key + '__filename__' in args:

Details

TestPage.html

The same problem exists with these versions: apache 1.3.34, mod_python 2.7.11, python 2.4.1 running on linux 2.4, moin 1.5.[12]

Bug also confirmed for: FreeBSD 6.1, python-2.4.3, mod_python-2.7.11, apache+mod_ssl-1.3.34+2.8.25_3: stacktrace.html

Workaround

Add this:

 if key is None:
     continue

to the top of the for loop in the mod_python version of _setup_args_from_cgi_form in request.py

Discussion

Fugly, but util.FieldStorage seems to be feeding us crap.

Please add the usual version details, including the mod_python version and OS.

Possible fix:

if key is not None and key + '__filename__' in args:
    # decode key

But first investigate why the field storage return None. It should return strings.

I guess both suggested fixes have pretty much the same effect... the value associated with the None key is [""], btw.

Using libapache-mod-python2.3 Version: 2:2.7.10-4 under Debian.

geert (nijpels@euronet.nl)

I see this too. Putting in if key is not None in each if statement in the loop for key in args: in decodeArgs makes this work.

TB: mointb.html

The error occurs in:

decodeArgs
request.py line 910

Platform: Linux 2.4.32xeon-2-smp #1 SMP Thu Nov 17 10:53:40 CET 2005 i686
Python: Python 2.3.4 (/usr/bin/python)
MoinMoin: Release 1.5.2 (release)
Debian sarge
mod_python 2.7.10-4

Patch: hg bundle for 1.6 attached: uploadfix -- NickPhillips

Plan


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/ModPyAttachmentUploadTypeError (last edited 2007-10-29 19:15:31 by localhost)