[multipart] unicode → six.text_type
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 01 Oct 2015 11:41:20 +0200
changeset 10745 5318337e7128
parent 10744 c5dc40988e6e
child 10746 407385314c0d
[multipart] unicode → six.text_type
multipart.py
--- a/multipart.py	Thu Oct 01 10:06:58 2015 +0200
+++ b/multipart.py	Thu Oct 01 11:41:20 2015 +0200
@@ -45,6 +45,7 @@
 except ImportError: # pragma: no cover (fallback for Python 2.5)
     from StringIO import StringIO as BytesIO
 
+from six import text_type
 from six.moves.urllib.parse import parse_qs
 
 ##############################################################################
@@ -87,7 +88,7 @@
                 yield key, value
 
 def tob(data, enc='utf8'): # Convert strings to bytes (py2 and py3)
-    return data.encode(enc) if isinstance(data, unicode) else data
+    return data.encode(enc) if isinstance(data, text_type) else data
 
 def copy_file(stream, target, maxread=-1, buffer_size=2*16):
     ''' Read from :stream and write to :target until :maxread or EOF. '''