Commit 500e0a8c authored by Denis Bilenko's avatar Denis Bilenko

use "print (xxx)" instead of print xxx for compatibility with py3k. Patch by Damien Churchill.

parent 1f9a1f06
...@@ -100,6 +100,6 @@ class _fileobject(socket._fileobject): ...@@ -100,6 +100,6 @@ class _fileobject(socket._fileobject):
if __name__ == '__main__': if __name__ == '__main__':
if not sys.argv[1:]: if not sys.argv[1:]:
print 'USAGE: %s PORT' % sys.argv[0] print ('USAGE: %s PORT' % sys.argv[0])
else: else:
BackdoorServer(('127.0.0.1', int(sys.argv[1]))).serve_forever() BackdoorServer(('127.0.0.1', int(sys.argv[1]))).serve_forever()
...@@ -105,7 +105,7 @@ class HTTPResponse(object): ...@@ -105,7 +105,7 @@ class HTTPResponse(object):
if self.debuglevel > 0: if self.debuglevel > 0:
for (k, v) in self.getheaders(): for (k, v) in self.getheaders():
print 'header:', k, v print ('header: %s %s' % (k, v))
def read(self, amt=-1): def read(self, amt=-1):
return self._request.input_buffer.read(amt) return self._request.input_buffer.read(amt)
...@@ -199,7 +199,7 @@ class HTTPConnection(object): ...@@ -199,7 +199,7 @@ class HTTPConnection(object):
if self.conn: return if self.conn: return
if self.debuglevel > 0: if self.debuglevel > 0:
print 'connect: (%s, %u)' % (self.host, self.port) print ('connect: (%s, %u)' % (self.host, self.port))
self.conn = core.http_connection.new(self.host, self.port, get_hub().reactor) self.conn = core.http_connection.new(self.host, self.port, get_hub().reactor)
...@@ -234,6 +234,6 @@ class HTTPConnection(object): ...@@ -234,6 +234,6 @@ class HTTPConnection(object):
def send(self, data): def send(self, data):
if self.debuglevel > 0: if self.debuglevel > 0:
print 'send:', repr(data) print ('send: %r' % data)
self.req.output_buffer.write(data) self.req.output_buffer.write(data)
...@@ -230,11 +230,11 @@ MONKEY OPTIONS: --verbose %s""" % ', '.join('--[no-]%s' % m for m in modules) ...@@ -230,11 +230,11 @@ MONKEY OPTIONS: --verbose %s""" % ', '.join('--[no-]%s' % m for m in modules)
if verbose: if verbose:
import pprint import pprint
import os import os
print 'gevent.monkey.patch_all(%s)' % ', '.join('%s=%s' % item for item in args.items()) print ('gevent.monkey.patch_all(%s)' % ', '.join('%s=%s' % item for item in args.items()))
print 'sys.version=%s' % (sys.version.strip().replace('\n', ' '), ) print ('sys.version=%s' % (sys.version.strip().replace('\n', ' '), ))
print 'sys.path=%s' % pprint.pformat(sys.path) print ('sys.path=%s' % pprint.pformat(sys.path))
print 'sys.modules=%s' % pprint.pformat(sorted(sys.modules.keys())) print ('sys.modules=%s' % pprint.pformat(sorted(sys.modules.keys())))
print 'cwd=%s' % os.getcwd() print ('cwd=%s' % os.getcwd())
patch_all(**args) patch_all(**args)
if argv: if argv:
...@@ -242,4 +242,4 @@ MONKEY OPTIONS: --verbose %s""" % ', '.join('--[no-]%s' % m for m in modules) ...@@ -242,4 +242,4 @@ MONKEY OPTIONS: --verbose %s""" % ', '.join('--[no-]%s' % m for m in modules)
__package__ = None __package__ = None
execfile(sys.argv[0]) execfile(sys.argv[0])
else: else:
print script_help print (script_help)
...@@ -230,7 +230,7 @@ Where /path/to/myapp.wsgi is a Python script that defines "application" callable ...@@ -230,7 +230,7 @@ Where /path/to/myapp.wsgi is a Python script that defines "application" callable
except AttributeError: except AttributeError:
sys.exit("Could not find application in %s" % filename) sys.exit("Could not find application in %s" % filename)
server = WSGIServer((options.interface, options.port), application, spawn=options.spawn) server = WSGIServer((options.interface, options.port), application, spawn=options.spawn)
print 'Serving %s on %s:%s' % (filename, options.interface, options.port) print ('Serving %s on %s:%s' % (filename, options.interface, options.port))
server.serve_forever() server.serve_forever()
else: else:
sys.stderr.write(parser.format_help()) sys.stderr.write(parser.format_help())
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment