summaryrefslogtreecommitdiffstats
path: root/openstack/common/wsgi.py
diff options
context:
space:
mode:
authorChuck Short <chuck.short@canonical.com>2013-05-01 09:40:43 -0500
committerChuck Short <chuck.short@canonical.com>2013-05-02 08:06:01 -0500
commit2f771aca390639cc49f71c451bd55c1d10db6f58 (patch)
tree5873dda954d351f5522a7451acb1215b7c85ab7c /openstack/common/wsgi.py
parent90e83530d4dc49d570fa05ea63a93805717dcfa0 (diff)
downloadoslo-2f771aca390639cc49f71c451bd55c1d10db6f58.tar.gz
oslo-2f771aca390639cc49f71c451bd55c1d10db6f58.tar.xz
oslo-2f771aca390639cc49f71c451bd55c1d10db6f58.zip
Improve python3 compatibility
Change print statements so that it works with python3 as well. Change-Id: Iff16b62e4b875c79862c9af7726ea77627aa7b4f Signed-off-by: Chuck Short <chuck.short@canonical.com>
Diffstat (limited to 'openstack/common/wsgi.py')
-rw-r--r--openstack/common/wsgi.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/openstack/common/wsgi.py b/openstack/common/wsgi.py
index 98a0874..064c09c 100644
--- a/openstack/common/wsgi.py
+++ b/openstack/common/wsgi.py
@@ -17,6 +17,8 @@
"""Utility methods for working with WSGI servers."""
+from __future__ import print_function
+
import eventlet
eventlet.patcher.monkey_patch(all=False, socket=True)
@@ -203,16 +205,16 @@ class Debug(Middleware):
@webob.dec.wsgify
def __call__(self, req):
- print ("*" * 40) + " REQUEST ENVIRON"
+ print(("*" * 40) + " REQUEST ENVIRON")
for key, value in req.environ.items():
- print key, "=", value
- print
+ print(key, "=", value)
+ print()
resp = req.get_response(self.application)
- print ("*" * 40) + " RESPONSE HEADERS"
+ print(("*" * 40) + " RESPONSE HEADERS")
for (key, value) in resp.headers.iteritems():
- print key, "=", value
- print
+ print(key, "=", value)
+ print()
resp.app_iter = self.print_generator(resp.app_iter)
@@ -224,12 +226,12 @@ class Debug(Middleware):
Iterator that prints the contents of a wrapper string iterator
when iterated.
"""
- print ("*" * 40) + " BODY"
+ print(("*" * 40) + " BODY")
for part in app_iter:
sys.stdout.write(part)
sys.stdout.flush()
yield part
- print
+ print()
class Router(object):