summaryrefslogtreecommitdiff
path: root/nova/wsgi.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-07-27 09:04:22 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-07-29 15:26:56 -0700
commit25afe4574c6f07e966d0d5afdc5c89e65432e3b6 (patch)
treee3459c98fd55fb282bba413f00f6e28d162af938 /nova/wsgi.py
parent4d98d7e55da938757d0d64776eb53edf29bc08f0 (diff)
downloadnova-25afe4574c6f07e966d0d5afdc5c89e65432e3b6.tar.gz
Enabled hacking check for Python3 compatible print (H233)
Also fixed all violators of this check. Change-Id: Id87ff6f44ab76fc59b18d5da739df475400e1259
Diffstat (limited to 'nova/wsgi.py')
-rw-r--r--nova/wsgi.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/nova/wsgi.py b/nova/wsgi.py
index 7e88e6b8bb..bb3d82ecba 100644
--- a/nova/wsgi.py
+++ b/nova/wsgi.py
@@ -19,6 +19,8 @@
"""Utility methods for working with WSGI servers."""
+from __future__ import print_function
+
import os.path
import socket
import sys
@@ -371,15 +373,15 @@ class Debug(Middleware):
@webob.dec.wsgify(RequestClass=Request)
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(key, '=', value)
print
resp.app_iter = self.print_generator(resp.app_iter)
@@ -389,12 +391,12 @@ class Debug(Middleware):
@staticmethod
def print_generator(app_iter):
"""Iterator that prints the contents of a wrapper string."""
- 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):