multipart.py
changeset 10745 5318337e7128
parent 10741 6666e52d8dd9
child 10746 407385314c0d
--- 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. '''