Patch for an Issue #1121

This commit is contained in:
Miroslav Stampar
2015-01-19 09:17:16 +01:00
parent e73ac6c8e3
commit 393659ffbf
2 changed files with 7 additions and 3 deletions

View File

@@ -81,9 +81,10 @@ class MultipartPostHandler(urllib2.BaseHandler):
buf = ''
for (key, value) in vars:
buf += '--%s\r\n' % boundary
buf += 'Content-Disposition: form-data; name="%s"' % key
buf += '\r\n\r\n' + value + '\r\n'
if key is not None and value is not None:
buf += '--%s\r\n' % boundary
buf += 'Content-Disposition: form-data; name="%s"' % key
buf += '\r\n\r\n' + value + '\r\n'
for (key, fd) in files:
file_size = os.fstat(fd.fileno())[stat.ST_SIZE] if isinstance(fd, file) else fd.len