diff options
| author | Cyril Roelandt <cyril.roelandt@enovance.com> | 2014-03-18 12:49:12 +0100 |
|---|---|---|
| committer | Cyril Roelandt <cyril.roelandt@enovance.com> | 2014-03-18 12:49:12 +0100 |
| commit | 674ae7718bc06a8b8c8b658075bf82c8198fb632 (patch) | |
| tree | 0075bace24ead7f03ae7cb18935e4c707f71a860 /paste/debug/testserver.py | |
| parent | 3cdb7e4227cbaad690b1c1557c03fa6da0decc36 (diff) | |
| download | paste-674ae7718bc06a8b8c8b658075bf82c8198fb632.tar.gz | |
Python 3: use new names of standard library modules
Use "try/except ImportError" to try Python 2 and Python 3 names.
Diffstat (limited to 'paste/debug/testserver.py')
| -rwxr-xr-x | paste/debug/testserver.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/paste/debug/testserver.py b/paste/debug/testserver.py index 26c477a..0adeefc 100755 --- a/paste/debug/testserver.py +++ b/paste/debug/testserver.py @@ -67,7 +67,7 @@ def serve(application, host=None, port=None, handler=None): return server if __name__ == '__main__': - import urllib + from six.moves.urllib.request import urlopen from paste.wsgilib import dump_environ server = serve(dump_environ) baseuri = ("http://%s:%s" % server.server_address) @@ -80,7 +80,7 @@ if __name__ == '__main__': import socket socket.setdefaulttimeout(5) # build a uri, fetch and return - return urllib.urlopen(baseuri + path).read() + return urlopen(baseuri + path).read() assert "PATH_INFO: /foo" in fetch("/foo") assert "PATH_INFO: /womble" in fetch("/womble") @@ -90,4 +90,4 @@ if __name__ == '__main__': # and then schedule a stop() server.stop() # and then... fetch it... - urllib.urlopen(baseuri) + urlopen(baseuri) |
