Commits

jayd3e committed cc2bbd9

Committing for Mike.

Comments (0)

Files changed (3)

tests/test_request.py

         req = Request.blank('/?%E1%80%80=x',
                             decode_param_names=True, charset='UTF-8')
         self.assertTrue(req.decode_param_names)
-        self.assertTrue(six.u('\u1000') in list(req.GET.keys()))
+        self.assertTrue(six.u('\u1000') in req.GET.keys())
         self.assertEqual(req.GET[six.u('\u1000')], 'x')
 
     def test_copy_body(self):
             self.assertTrue(i in r.headers and
                 'HTTP_'+i.upper().replace('-', '_') in r.environ)
         r.headers = {'Server':'Apache'}
-        self.assertEqual(r.environ.keys(), ['a',  'HTTP_SERVER'])
+        self.assertEqual(list(r.environ.keys()), ['a',  'HTTP_SERVER'])
 
     def test_host_url(self):
         # Request has a read only property host_url that combines several
 
         req = Request.blank('/', method='PUT', body=b'abc')
         resp = req.get_response(mw)
-        self.assertEqual(resp.body, 'abc')
-        self.assertEqual(resp.headers['x-data'], 'abc')
+        self.assertEqual(resp.body, b'abc')
+        self.assertEqual(resp.headers['x-data'], b'abc')
 
     def test_body_file_noseek(self):
         req = Request.blank('/', method='PUT', body=b'abc')

webob/multidict.py

     def _iteritems(obj):
         return obj.items()
     def _iterkeys(obj):
-        return obj.items()
+        return obj.keys()
     def _itervalues(obj):
         return obj.values()
 else:
             if skip_body > 1:
                 if len(self.body) > skip_body:
                     body = '<body skipped (len=%s)>' % len(self.body)
+                    body = body.encode('UTF-8')
                 else:
                     skip_body = False
             if not skip_body:
                 body = self.body
-
-        parts += map('%s: %s'.__mod__, sorted(self.headers.items()))
+            
+        headers = list(self.headers.items())
+        parts += map('%s: %s'.__mod__, sorted(headers))
         if body:
-            parts += '', str(body)
+            parts += '', body.decode('UTF-8')
         return '\r\n'.join(parts)
 
     __str__ = as_string
             clen = r.content_length
             if clen is None:
                 body = fp.read()
-                r.body = body.encode('iso-8859-1')
+                r.body = body.encode('UTF-8')
             else:
                 body = fp.read(clen)
-                r.body = body.encode('iso-8859-1')
+                r.body = body.encode('UTF-8')
         return r
 
     def call_application(self, application, catch_exc_info=False):