Commits

Andriy Kornatskyy  committed 1bf681a

Updated demos for python3.2 compatibility

  • Participants
  • Parent commits d02f834

Comments (0)

Files changed (4)

File demos/hello/helloworld.py

     start_response('200 OK', [
         ('Content-type', 'text/html')
     ])
-    return ["Hello World!"]
+    return ["Hello World!".encode('utf8')]
 
 
 r = Router()

File demos/hello/test_helloworld.py

 
         for path in ('/', '/Welcome'):
             environ = {'PATH_INFO': path}
-            response = main(environ, start_response)
+            response = list(map(lambda c: c.decode('utf-8'),
+                main(environ, start_response)))
 
             self.assertEquals(['Hello World!'], response)

File demos/time/app.py

 def main(environ, start_response):
     handler, kwargs = r.match(environ['PATH_INFO'][1:])
     environ['routing.kwargs'] = kwargs
-    return handler(environ, start_response)
+    return map(lambda chunk: chunk.encode('utf8'),
+            handler(environ, start_response))
 
 if __name__ == '__main__':
     from wsgiref.simple_server import make_server

File demos/time/test_functional.py

             assert expected_status == status
 
         environ = {'PATH_INFO': path}
-        return ''.join(main(environ, start_response))
+        return ''.join(map(lambda chunk: chunk.decode('utf-8'),
+            main(environ, start_response)))
 
     def test_welcome(self):
         """ Welcome page must have a valid path