[web/request] don't convert request parameters if py3k
authorRémi Cardona <remi.cardona@logilab.fr>
Wed, 16 Sep 2015 16:07:29 +0200
changeset 10693 be0bd5aa21b4
parent 10692 14e7ddb0f670
child 10694 7ece2df9cc5c
[web/request] don't convert request parameters if py3k
web/request.py
--- a/web/request.py	Wed Sep 16 16:02:04 2015 +0200
+++ b/web/request.py	Wed Sep 16 16:07:29 2015 +0200
@@ -28,7 +28,7 @@
 from warnings import warn
 from io import BytesIO
 
-from six import text_type, string_types
+from six import PY2, text_type, string_types
 from six.moves import http_client
 from six.moves.urllib.parse import urlsplit, quote as urlquote
 from six.moves.http_cookies import SimpleCookie
@@ -253,10 +253,11 @@
         encoding = self.encoding
         for param, val in params.items():
             if isinstance(val, (tuple, list)):
-                val = [unicode(x, encoding) for x in val]
+                if PY2:
+                    val = [unicode(x, encoding) for x in val]
                 if len(val) == 1:
                     val = val[0]
-            elif isinstance(val, str):
+            elif PY2 and isinstance(val, str):
                 val = unicode(val, encoding)
             if param in self.no_script_form_params and val:
                 val = self.no_script_form_param(param, val)