1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
Description: MIME document needs to be bytes in python3
Origin: commit, revision id: dimitri.j.ledkov@intel.com-20150211040157-2hyi9olcaaoc3x5p
Author: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Bug: https://launchpad.net/bugs/1414063
Last-Update: 2015-02-11
X-Bzr-Revision-Id: dimitri.j.ledkov@intel.com-20150211040157-2hyi9olcaaoc3x5p
=== modified file 'src/wadllib/application.py'
--- old/src/wadllib/application.py 2013-02-25 18:53:09 +0000
+++ new/src/wadllib/application.py 2015-02-11 03:56:31 +0000
@@ -853,11 +853,10 @@
inner['Content-Disposition'] = (
'form-data; name="%s"' % param.name)
outer.attach(inner)
- doc = str(outer)
- # Chop off the 'From' line, which only makes sense in an
- # email. (Python 3 does not include it.)
- if doc.startswith('From '):
- doc = doc[doc.find('\n')+1:]
+ if hasattr(outer, "as_bytes"):
+ doc = outer.as_bytes()
+ else:
+ doc = outer.as_string(unixfrom=False)
media_type = (outer.get_content_type() +
'; boundary="%s"' % outer.get_boundary())
elif media_type == 'application/json':
|