summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cherrypy/_cperror.py12
-rw-r--r--cherrypy/_cplogging.py3
-rw-r--r--cherrypy/_cpmodpy.py4
-rw-r--r--cherrypy/_cpreqbody.py54
-rw-r--r--cherrypy/_cprequest.py6
-rw-r--r--cherrypy/_cpwsgi.py4
-rw-r--r--cherrypy/lib/caching.py4
-rw-r--r--cherrypy/lib/encoding.py14
-rw-r--r--cherrypy/lib/httputil.py10
-rw-r--r--cherrypy/lib/static.py6
-rw-r--r--cherrypy/test/_test_decorators.py3
-rw-r--r--cherrypy/test/benchmark.py11
-rw-r--r--cherrypy/test/helper.py2
-rw-r--r--cherrypy/test/logtest.py2
-rw-r--r--cherrypy/test/test_auth_basic.py2
-rw-r--r--cherrypy/test/test_caching.py13
-rw-r--r--cherrypy/test/test_config.py3
-rw-r--r--cherrypy/test/test_conn.py34
-rw-r--r--cherrypy/test/test_core.py8
-rw-r--r--cherrypy/test/test_encoding.py32
-rw-r--r--cherrypy/test/test_http.py14
-rw-r--r--cherrypy/test/test_httpauth.py4
-rw-r--r--cherrypy/test/test_logging.py4
-rw-r--r--cherrypy/test/test_mime.py44
-rw-r--r--cherrypy/test/test_request_obj.py14
-rw-r--r--cherrypy/test/test_tools.py14
-rw-r--r--cherrypy/test/test_wsgi_ns.py5
-rw-r--r--cherrypy/test/test_wsgiapps.py2
28 files changed, 161 insertions, 167 deletions
diff --git a/cherrypy/_cperror.py b/cherrypy/_cperror.py
index 1e6214c0..8b90cefd 100644
--- a/cherrypy/_cperror.py
+++ b/cherrypy/_cperror.py
@@ -572,7 +572,7 @@ def _be_ie_unfriendly(status):
if content_length and content_length < s:
# IN ADDITION: the response must be written to IE
# in one chunk or it will still get replaced! Bah.
- content = content + (ntob(' ') * (s - content_length))
+ content = content + (b' ' * (s - content_length))
response.body = content
response.headers['Content-Length'] = str(len(content))
@@ -607,13 +607,13 @@ def bare_error(extrabody=None):
# it cannot be allowed to fail. Therefore, don't add to it!
# In particular, don't call any other CP functions.
- body = ntob('Unrecoverable error in the server.')
+ body = b'Unrecoverable error in the server.'
if extrabody is not None:
if not isinstance(extrabody, bytes):
extrabody = extrabody.encode('utf-8')
- body += ntob('\n') + extrabody
+ body += b'\n' + extrabody
- return (ntob('500 Internal Server Error'),
- [(ntob('Content-Type'), ntob('text/plain')),
- (ntob('Content-Length'), ntob(str(len(body)), 'ISO-8859-1'))],
+ return (b'500 Internal Server Error',
+ [(b'Content-Type', b'text/plain'),
+ (b'Content-Length', ntob(str(len(body)), 'ISO-8859-1'))],
[body])
diff --git a/cherrypy/_cplogging.py b/cherrypy/_cplogging.py
index 982d6f6e..ff06f4e7 100644
--- a/cherrypy/_cplogging.py
+++ b/cherrypy/_cplogging.py
@@ -117,7 +117,6 @@ import six
import cherrypy
from cherrypy import _cperror
-from cherrypy._cpcompat import ntob
# Silence the no-handlers "warning" (stderr write!) in stdlib logging
@@ -254,7 +253,7 @@ class LogManager(object):
if response.output_status is None:
status = '-'
else:
- status = response.output_status.split(ntob(' '), 1)[0]
+ status = response.output_status.split(b' ', 1)[0]
if six.PY3:
status = status.decode('ISO-8859-1')
diff --git a/cherrypy/_cpmodpy.py b/cherrypy/_cpmodpy.py
index 559aa79a..337835f5 100644
--- a/cherrypy/_cpmodpy.py
+++ b/cherrypy/_cpmodpy.py
@@ -64,7 +64,7 @@ import sys
import six
import cherrypy
-from cherrypy._cpcompat import ntob, text_or_bytes
+from cherrypy._cpcompat import text_or_bytes
from cherrypy._cperror import format_exc, bare_error
from cherrypy.lib import httputil
@@ -296,7 +296,7 @@ def read_process(cmd, args=''):
try:
firstline = pipeout.readline()
cmd_not_found = re.search(
- ntob('(not recognized|No such file|not found)'),
+ b'(not recognized|No such file|not found)',
firstline,
re.IGNORECASE
)
diff --git a/cherrypy/_cpreqbody.py b/cherrypy/_cpreqbody.py
index d2388897..e5618099 100644
--- a/cherrypy/_cpreqbody.py
+++ b/cherrypy/_cpreqbody.py
@@ -135,7 +135,7 @@ import six
import cheroot.server
import cherrypy
-from cherrypy._cpcompat import text_or_bytes, ntob, ntou
+from cherrypy._cpcompat import text_or_bytes, ntou
from cherrypy.lib import httputil
@@ -147,14 +147,14 @@ def process_urlencoded(entity):
for charset in entity.attempt_charsets:
try:
params = {}
- for aparam in qs.split(ntob('&')):
- for pair in aparam.split(ntob(';')):
+ for aparam in qs.split(b'&'):
+ for pair in aparam.split(b';'):
if not pair:
continue
- atoms = pair.split(ntob('='), 1)
+ atoms = pair.split(b'=', 1)
if len(atoms) == 1:
- atoms.append(ntob(''))
+ atoms.append(b'')
key = unquote_plus(atoms[0]).decode(charset)
value = unquote_plus(atoms[1]).decode(charset)
@@ -633,17 +633,17 @@ class Part(Entity):
# No more data--illegal end of headers
raise EOFError('Illegal end of headers.')
- if line == ntob('\r\n'):
+ if line == b'\r\n':
# Normal end of headers
break
- if not line.endswith(ntob('\r\n')):
+ if not line.endswith(b'\r\n'):
raise ValueError('MIME requires CRLF terminators: %r' % line)
- if line[0] in ntob(' \t'):
+ if line[0] in b' \t':
# It's a continuation line.
v = line.strip().decode('ISO-8859-1')
else:
- k, v = line.split(ntob(':'), 1)
+ k, v = line.split(b':', 1)
k = k.strip().decode('ISO-8859-1')
v = v.strip().decode('ISO-8859-1')
@@ -664,8 +664,8 @@ class Part(Entity):
object that supports the 'write' method; all bytes read will be
written to the fp, and that fp is returned.
"""
- endmarker = self.boundary + ntob('--')
- delim = ntob('')
+ endmarker = self.boundary + b'--'
+ delim = b''
prev_lf = True
lines = []
seen = 0
@@ -673,7 +673,7 @@ class Part(Entity):
line = self.fp.readline(1 << 16)
if not line:
raise EOFError('Illegal end of multipart body.')
- if line.startswith(ntob('--')) and prev_lf:
+ if line.startswith(b'--') and prev_lf:
strippedline = line.strip()
if strippedline == self.boundary:
break
@@ -683,16 +683,16 @@ class Part(Entity):
line = delim + line
- if line.endswith(ntob('\r\n')):
- delim = ntob('\r\n')
+ if line.endswith(b'\r\n'):
+ delim = b'\r\n'
line = line[:-2]
prev_lf = True
- elif line.endswith(ntob('\n')):
- delim = ntob('\n')
+ elif line.endswith(b'\n'):
+ delim = b'\n'
line = line[:-1]
prev_lf = True
else:
- delim = ntob('')
+ delim = b''
prev_lf = False
if fp_out is None:
@@ -706,7 +706,7 @@ class Part(Entity):
fp_out.write(line)
if fp_out is None:
- result = ntob('').join(lines)
+ result = b''.join(lines)
return result
else:
fp_out.seek(0)
@@ -750,7 +750,7 @@ class SizedReader:
self.fp = fp
self.length = length
self.maxbytes = maxbytes
- self.buffer = ntob('')
+ self.buffer = b''
self.bufsize = bufsize
self.bytes_read = 0
self.done = False
@@ -786,7 +786,7 @@ class SizedReader:
if remaining == 0:
self.finish()
if fp_out is None:
- return ntob('')
+ return b''
else:
return None
@@ -796,7 +796,7 @@ class SizedReader:
if self.buffer:
if remaining is inf:
data = self.buffer
- self.buffer = ntob('')
+ self.buffer = b''
else:
data = self.buffer[:remaining]
self.buffer = self.buffer[remaining:]
@@ -845,7 +845,7 @@ class SizedReader:
fp_out.write(data)
if fp_out is None:
- return ntob('').join(chunks)
+ return b''.join(chunks)
def readline(self, size=None):
"""Read a line from the request body and return it."""
@@ -857,7 +857,7 @@ class SizedReader:
data = self.read(chunksize)
if not data:
break
- pos = data.find(ntob('\n')) + 1
+ pos = data.find(b'\n') + 1
if pos:
chunks.append(data[:pos])
remainder = data[pos:]
@@ -866,7 +866,7 @@ class SizedReader:
break
else:
chunks.append(data)
- return ntob('').join(chunks)
+ return b''.join(chunks)
def readlines(self, sizehint=None):
"""Read lines from the request body and return them."""
@@ -895,12 +895,12 @@ class SizedReader:
try:
for line in self.fp.read_trailer_lines():
- if line[0] in ntob(' \t'):
+ if line[0] in b' \t':
# It's a continuation line.
v = line.strip()
else:
try:
- k, v = line.split(ntob(':'), 1)
+ k, v = line.split(b':', 1)
except ValueError:
raise ValueError('Illegal header line.')
k = k.strip().title()
@@ -909,7 +909,7 @@ class SizedReader:
if k in cheroot.server.comma_separated_headers:
existing = self.trailers.get(k)
if existing:
- v = ntob(', ').join((existing, v))
+ v = b', '.join((existing, v))
self.trailers[k] = v
except Exception:
e = sys.exc_info()[1]
diff --git a/cherrypy/_cprequest.py b/cherrypy/_cprequest.py
index ddff3669..069ccb9b 100644
--- a/cherrypy/_cprequest.py
+++ b/cherrypy/_cprequest.py
@@ -900,7 +900,7 @@ class Response(object):
raise TypeError("Chunk %s is not of type 'bytes'." %
repr(chunk))
newbody.append(chunk)
- newbody = ntob('').join(newbody)
+ newbody = b''.join(newbody)
self.body = newbody
return newbody
@@ -916,7 +916,7 @@ class Response(object):
self.status = '%s %s' % (code, reason)
self.output_status = ntob(str(code), 'ascii') + \
- ntob(' ') + headers.encode(reason)
+ b' ' + headers.encode(reason)
if self.stream:
# The upshot: wsgiserver will chunk the response if
@@ -929,7 +929,7 @@ class Response(object):
# and 304 (not modified) responses MUST NOT
# include a message-body."
dict.pop(headers, 'Content-Length', None)
- self.body = ntob('')
+ self.body = b''
else:
# Responses which are not streamed should have a Content-Length,
# but allow user code to set Content-Length if desired.
diff --git a/cherrypy/_cpwsgi.py b/cherrypy/_cpwsgi.py
index a9c9083b..0b4942ff 100644
--- a/cherrypy/_cpwsgi.py
+++ b/cherrypy/_cpwsgi.py
@@ -13,7 +13,7 @@ import io
import six
import cherrypy as _cherrypy
-from cherrypy._cpcompat import ntob, ntou
+from cherrypy._cpcompat import ntou
from cherrypy import _cperror
from cherrypy.lib import httputil
from cherrypy.lib import is_closable_iterator
@@ -223,7 +223,7 @@ class _TrappedResponse(object):
raise
if self.started_response:
- return ntob('').join(b)
+ return b''.join(b)
else:
return b
diff --git a/cherrypy/lib/caching.py b/cherrypy/lib/caching.py
index c4449d85..aa265164 100644
--- a/cherrypy/lib/caching.py
+++ b/cherrypy/lib/caching.py
@@ -41,7 +41,7 @@ import six
import cherrypy
from cherrypy.lib import cptools, httputil
-from cherrypy._cpcompat import ntob, Event
+from cherrypy._cpcompat import Event
class Cache(object):
@@ -406,7 +406,7 @@ def tee_output():
yield chunk
# save the cache data
- body = ntob('').join(output)
+ body = b''.join(output)
cherrypy._cache.put((response.status, response.headers or {},
body, response.time), len(body))
diff --git a/cherrypy/lib/encoding.py b/cherrypy/lib/encoding.py
index 72e58f9c..0fc15225 100644
--- a/cherrypy/lib/encoding.py
+++ b/cherrypy/lib/encoding.py
@@ -5,7 +5,7 @@ import io
import six
import cherrypy
-from cherrypy._cpcompat import text_or_bytes, ntob
+from cherrypy._cpcompat import text_or_bytes
from cherrypy.lib import file_generator
from cherrypy.lib import is_closable_iterator
from cherrypy.lib import set_vary_header
@@ -277,15 +277,15 @@ def compress(body, compress_level):
import zlib
# See http://www.gzip.org/zlib/rfc-gzip.html
- yield ntob('\x1f\x8b') # ID1 and ID2: gzip marker
- yield ntob('\x08') # CM: compression method
- yield ntob('\x00') # FLG: none set
+ yield b'\x1f\x8b' # ID1 and ID2: gzip marker
+ yield b'\x08' # CM: compression method
+ yield b'\x00' # FLG: none set
# MTIME: 4 bytes
yield struct.pack('<L', int(time.time()) & int('FFFFFFFF', 16))
- yield ntob('\x02') # XFL: max compression, slowest algo
- yield ntob('\xff') # OS: unknown
+ yield b'\x02' # XFL: max compression, slowest algo
+ yield b'\xff' # OS: unknown
- crc = zlib.crc32(ntob(''))
+ crc = zlib.crc32(b'')
size = 0
zobj = zlib.compressobj(compress_level,
zlib.DEFLATED, -zlib.MAX_WBITS,
diff --git a/cherrypy/lib/httputil.py b/cherrypy/lib/httputil.py
index aa3dd6d4..66ba0114 100644
--- a/cherrypy/lib/httputil.py
+++ b/cherrypy/lib/httputil.py
@@ -56,11 +56,11 @@ def urljoin_bytes(*atoms):
This will correctly join a SCRIPT_NAME and PATH_INFO into the
original URL, even if either atom is blank.
"""
- url = ntob('/').join([x for x in atoms if x])
- while ntob('//') in url:
- url = url.replace(ntob('//'), ntob('/'))
+ url = b'/'.join([x for x in atoms if x])
+ while b'//' in url:
+ url = url.replace(b'//', b'/')
# Special-case the final url of "", and return "/" instead.
- return url or ntob('/')
+ return url or b'/'
def protocol_from_http(protocol_str):
@@ -538,7 +538,7 @@ class HeaderMap(CaseInsensitiveDict):
# because we never want to fold lines--folding has
# been deprecated by the HTTP working group.
v = b2a_base64(v.encode('utf-8'))
- return (ntob('=?utf-8?b?') + v.strip(ntob('\n')) + ntob('?='))
+ return (b'=?utf-8?b?' + v.strip(b'\n') + b'?=')
raise ValueError('Could not encode header part %r using '
'any of the encodings %r.' %
diff --git a/cherrypy/lib/static.py b/cherrypy/lib/static.py
index ed6467a0..da9d9373 100644
--- a/cherrypy/lib/static.py
+++ b/cherrypy/lib/static.py
@@ -204,7 +204,7 @@ def _serve_fileobj(fileobj, content_type, content_length, debug=False):
def file_ranges():
# Apache compatibility:
- yield ntob('\r\n')
+ yield b'\r\n'
for start, stop in r:
if debug:
@@ -223,12 +223,12 @@ def _serve_fileobj(fileobj, content_type, content_length, debug=False):
gen = file_generator_limited(fileobj, stop - start)
for chunk in gen:
yield chunk
- yield ntob('\r\n')
+ yield b'\r\n'
# Final boundary
yield ntob('--' + boundary + '--', 'ascii')
# Apache compatibility:
- yield ntob('\r\n')
+ yield b'\r\n'
response.body = file_ranges()
return response.body
else:
diff --git a/cherrypy/test/_test_decorators.py b/cherrypy/test/_test_decorators.py
index f6b3e1b1..74832e40 100644
--- a/cherrypy/test/_test_decorators.py
+++ b/cherrypy/test/_test_decorators.py
@@ -2,7 +2,6 @@
import cherrypy
from cherrypy import expose, tools
-from cherrypy._cpcompat import ntob
class ExposeExamples(object):
@@ -37,4 +36,4 @@ class ToolExamples(object):
@cherrypy.config(**{'response.stream': True})
@tools.response_headers(headers=[('Content-Type', 'application/data')])
def blah(self):
- yield ntob('blah')
+ yield b'blah'
diff --git a/cherrypy/test/benchmark.py b/cherrypy/test/benchmark.py
index 5bfcf699..b57c1945 100644
--- a/cherrypy/test/benchmark.py
+++ b/cherrypy/test/benchmark.py
@@ -28,7 +28,6 @@ import sys
import time
import cherrypy
-from cherrypy._cpcompat import ntob
from cherrypy import _cperror, _cpmodpy
from cherrypy.lib import httputil
@@ -191,15 +190,15 @@ Finished 1000 requests
parse_patterns = [
('complete_requests', 'Completed',
- ntob(r'^Complete requests:\s*(\d+)')),
+ br'^Complete requests:\s*(\d+)'),
('failed_requests', 'Failed',
- ntob(r'^Failed requests:\s*(\d+)')),
+ br'^Failed requests:\s*(\d+)'),
('requests_per_second', 'req/sec',
- ntob(r'^Requests per second:\s*([0-9.]+)')),
+ br'^Requests per second:\s*([0-9.]+)'),
('time_per_request_concurrent', 'msec/req',
- ntob(r'^Time per request:\s*([0-9.]+).*concurrent requests\)$')),
+ br'^Time per request:\s*([0-9.]+).*concurrent requests\)$'),
('transfer_rate', 'KB/sec',
- ntob(r'^Transfer rate:\s*([0-9.]+)'))
+ br'^Transfer rate:\s*([0-9.]+)')
]
def __init__(self, path=SCRIPT_NAME + '/hello', requests=1000,
diff --git a/cherrypy/test/helper.py b/cherrypy/test/helper.py
index bdf74f86..01c5a0c0 100644
--- a/cherrypy/test/helper.py
+++ b/cherrypy/test/helper.py
@@ -344,7 +344,7 @@ class CPWebCase(webtest.WebCase):
epage = re.escape(page)
epage = epage.replace(
esc('<pre id="traceback"></pre>'),
- esc('<pre id="traceback">') + ntob('(.*)') + esc('</pre>'))
+ esc('<pre id="traceback">') + b'(.*)' + esc('</pre>'))
m = re.match(epage, self.body, re.DOTALL)
if not m:
self._handlewebError(
diff --git a/cherrypy/test/logtest.py b/cherrypy/test/logtest.py
index b51a0e32..ed8f1540 100644
--- a/cherrypy/test/logtest.py
+++ b/cherrypy/test/logtest.py
@@ -47,7 +47,7 @@ class LogCase(object):
logfile = None
lastmarker = None
- markerPrefix = ntob('test suite marker: ')
+ markerPrefix = b'test suite marker: '
def _handleLogError(self, msg, data, marker, pattern):
print('')
diff --git a/cherrypy/test/test_auth_basic.py b/cherrypy/test/test_auth_basic.py
index 48582ec2..cb3b344f 100644
--- a/cherrypy/test/test_auth_basic.py
+++ b/cherrypy/test/test_auth_basic.py
@@ -35,7 +35,7 @@ class BasicAuthTest(helper.CPWebCase):
cherrypy.request.login)
userpassdict = {'xuser': 'xpassword'}
- userhashdict = {'xuser': md5(ntob('xpassword')).hexdigest()}
+ userhashdict = {'xuser': md5(b'xpassword').hexdigest()}
def checkpasshash(realm, user, password):
p = userhashdict.get(user)
diff --git a/cherrypy/test/test_caching.py b/cherrypy/test/test_caching.py
index 4a459a3f..1a6ed4f2 100644
--- a/cherrypy/test/test_caching.py
+++ b/cherrypy/test/test_caching.py
@@ -10,7 +10,6 @@ from six.moves import urllib
import pytest
import cherrypy
-from cherrypy._cpcompat import ntob
from cherrypy.lib import httputil
from cherrypy.test import helper
@@ -18,10 +17,10 @@ from cherrypy.test import helper
curdir = os.path.join(os.getcwd(), os.path.dirname(__file__))
-gif_bytes = ntob(
- 'GIF89a\x01\x00\x01\x00\x82\x00\x01\x99"\x1e\x00\x00\x00\x00\x00'
- '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
- '\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x02\x03\x02\x08\t\x00;'
+gif_bytes = (
+ b'GIF89a\x01\x00\x01\x00\x82\x00\x01\x99"\x1e\x00\x00\x00\x00\x00'
+ b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
+ b'\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x02\x03\x02\x08\t\x00;'
)
@@ -179,7 +178,7 @@ class CacheTest(helper.CPWebCase):
self.assertHeader('Content-Encoding', 'gzip')
self.assertHeader('Vary')
self.assertEqual(
- cherrypy.lib.encoding.decompress(self.body), ntob('visit #5'))
+ cherrypy.lib.encoding.decompress(self.body), b'visit #5')
# Now check that a second request gets the gzip header and gzipped body
# This also tests a bug in 3.0 to 3.0.2 whereby the cached, gzipped
@@ -187,7 +186,7 @@ class CacheTest(helper.CPWebCase):
self.getPage('/', method='GET', headers=[('Accept-Encoding', 'gzip')])
self.assertHeader('Content-Encoding', 'gzip')
self.assertEqual(
- cherrypy.lib.encoding.decompress(self.body), ntob('visit #5'))
+ cherrypy.lib.encoding.decompress(self.body), b'visit #5')
# Now check that a third request that doesn't accept gzip
# skips the cache (because the 'Vary' header denies it).
diff --git a/cherrypy/test/test_config.py b/cherrypy/test/test_config.py
index 70fe535b..be17df90 100644
--- a/cherrypy/test/test_config.py
+++ b/cherrypy/test/test_config.py
@@ -8,7 +8,6 @@ import unittest
import six
import cherrypy
-import cherrypy._cpcompat as compat
from cherrypy.test import helper
@@ -241,7 +240,7 @@ class ConfigTests(helper.CPWebCase):
self.getPage('/plain', method='POST', headers=[
('Content-Type', 'application/x-www-form-urlencoded'),
('Content-Length', '13')],
- body=compat.ntob('\xff\xfex\x00=\xff\xfea\x00b\x00c\x00'))
+ body=b'\xff\xfex\x00=\xff\xfea\x00b\x00c\x00')
self.assertBody('abc')
diff --git a/cherrypy/test/test_conn.py b/cherrypy/test/test_conn.py
index 06676286..7d60c6fb 100644
--- a/cherrypy/test/test_conn.py
+++ b/cherrypy/test/test_conn.py
@@ -304,7 +304,7 @@ class PipelineTests(helper.CPWebCase):
conn = self.HTTP_CONN
conn.auto_open = False
conn.connect()
- conn.send(ntob('GET /hello HTTP/1.1'))
+ conn.send(b'GET /hello HTTP/1.1')
conn.send(('Host: %s' % self.HOST).encode('ascii'))
# Wait for our socket timeout
@@ -337,7 +337,7 @@ class PipelineTests(helper.CPWebCase):
self.assertBody(str(timeout))
# Make a second request on the same socket
- conn._output(ntob('GET /hello HTTP/1.1'))
+ conn._output(b'GET /hello HTTP/1.1')
conn._output(ntob('Host: %s' % self.HOST, 'ascii'))
conn._send_output()
response = conn.response_class(conn.sock, method='GET')
@@ -350,7 +350,7 @@ class PipelineTests(helper.CPWebCase):
time.sleep(timeout * 2)
# Make another request on the same socket, which should error
- conn._output(ntob('GET /hello HTTP/1.1'))
+ conn._output(b'GET /hello HTTP/1.1')
conn._output(ntob('Host: %s' % self.HOST, 'ascii'))
conn._send_output()
response = conn.response_class(conn.sock, method='GET')
@@ -383,7 +383,7 @@ class PipelineTests(helper.CPWebCase):
# Make another request on the same socket,
# but timeout on the headers
- conn.send(ntob('GET /hello HTTP/1.1'))
+ conn.send(b'GET /hello HTTP/1.1')
# Wait for our socket timeout
time.sleep(timeout * 2)
response = conn.response_class(conn.sock, method='GET')
@@ -431,7 +431,7 @@ class PipelineTests(helper.CPWebCase):
for trial in range(5):
# Put next request
- conn._output(ntob('GET /hello HTTP/1.1'))
+ conn._output(b'GET /hello HTTP/1.1')
conn._output(ntob('Host: %s' % self.HOST, 'ascii'))
conn._send_output()
@@ -446,14 +446,14 @@ class PipelineTests(helper.CPWebCase):
response.begin()
body = response.read(13)
self.assertEqual(response.status, 200)
- self.assertEqual(body, ntob('Hello, world!'))
+ self.assertEqual(body, b'Hello, world!')
# Retrieve final response
response = conn.response_class(conn.sock, method='GET')
response.begin()
body = response.read()
self.assertEqual(response.status, 200)
- self.assertEqual(body, ntob('Hello, world!'))
+ self.assertEqual(body, b'Hello, world!')
conn.close()
@@ -506,7 +506,7 @@ class PipelineTests(helper.CPWebCase):
break
# ...send the body
- body = ntob('I am a small file')
+ body = b'I am a small file'
conn.send(body)
# ...get the final response
@@ -566,11 +566,11 @@ class ConnectionTests(helper.CPWebCase):
self.assertStatus(500)
# Now try a working page with an Expect header...
- conn._output(ntob('POST /upload HTTP/1.1'))
+ conn._output(b'POST /upload HTTP/1.1')
conn._output(ntob('Host: %s' % self.HOST, 'ascii'))
- conn._output(ntob('Content-Type: text/plain'))
- conn._output(ntob('Content-Length: 17'))
- conn._output(ntob('Expect: 100-continue'))
+ conn._output(b'Content-Type: text/plain')
+ conn._output(b'Content-Length: 17')
+ conn._output(b'Expect: 100-continue')
conn._send_output()
response = conn.response_class(conn.sock, method='POST')
@@ -583,7 +583,7 @@ class ConnectionTests(helper.CPWebCase):
break
# ...send the body
- body = ntob('I am a small file')
+ body = b'I am a small file'
conn.send(body)
# ...get the final response
@@ -654,7 +654,7 @@ class ConnectionTests(helper.CPWebCase):
response = conn.getresponse()
self.status, self.headers, self.body = webtest.shb(response)
self.assertStatus('200 OK')
- self.assertBody("thanks for '%s'" % ntob('xx\r\nxxxxyyyyy'))
+ self.assertBody("thanks for '%s'" % b'xx\r\nxxxxyyyyy')
# Try a chunked request that exceeds server.max_request_body_size.
# Note that the delimiters and trailer are included.
@@ -839,7 +839,7 @@ class LimitedRequestQueueTests(helper.CPWebCase):
raise AssertionError('Overflow conn did not get RST ')
finally:
for conn in conns:
- conn.send(ntob('done'))
+ conn.send(b'done')
response = conn.response_class(conn.sock, method='POST')
response.begin()
self.body = response.read()
@@ -857,7 +857,7 @@ class BadRequestTests(helper.CPWebCase):
self.persistent = True
conn = self.HTTP_CONN
- conn.send(ntob('GET /hello HTTP/1.1\n\n'))
+ conn.send(b'GET /hello HTTP/1.1\n\n')
response = conn.response_class(conn.sock, method='GET')
response.begin()
self.body = response.read()
@@ -865,7 +865,7 @@ class BadRequestTests(helper.CPWebCase):
conn.close()
conn.connect()
- conn.send(ntob('GET /hello HTTP/1.1\r\n\n'))
+ conn.send(b'GET /hello HTTP/1.1\r\n\n')
response = conn.response_class(conn.sock, method='GET')
response.begin()
self.body = response.read()
diff --git a/cherrypy/test/test_core.py b/cherrypy/test/test_core.py
index ef5f5016..9834c1f3 100644
--- a/cherrypy/test/test_core.py
+++ b/cherrypy/test/test_core.py
@@ -9,7 +9,7 @@ import types
import six
import cherrypy
-from cherrypy._cpcompat import ntob, ntou
+from cherrypy._cpcompat import ntou
from cherrypy import _cptools, tools
from cherrypy.lib import httputil, static
@@ -235,7 +235,7 @@ class CoreRequestHandlingTest(helper.CPWebCase):
return ['con', 'tent']
def as_yield(self):
- yield ntob('content')
+ yield b'content'
@cherrypy.config(**{'tools.flatten.on': True})
def as_dblyield(self):
@@ -279,8 +279,8 @@ class CoreRequestHandlingTest(helper.CPWebCase):
def header_list(self):
pass
header_list = cherrypy.tools.append_headers(header_list=[
- (ntob('WWW-Authenticate'), ntob('Negotiate')),
- (ntob('WWW-Authenticate'), ntob('Basic realm="foo"')),
+ (b'WWW-Authenticate', b'Negotiate'),
+ (b'WWW-Authenticate', b'Basic realm="foo"'),
])(header_list)
def commas(self):
diff --git a/cherrypy/test/test_encoding.py b/cherrypy/test/test_encoding.py
index 62d7fb16..97adad94 100644
--- a/cherrypy/test/test_encoding.py
+++ b/cherrypy/test/test_encoding.py
@@ -54,7 +54,7 @@ class EncodingTests(helper.CPWebCase):
@cherrypy.expose
def reqparams(self, *args, **kwargs):
- return ntob(', ').join(
+ return b', '.join(
[': '.join((k, v)).encode('utf8')
for k, v in sorted(cherrypy.request.params.items())]
)
@@ -129,7 +129,7 @@ class EncodingTests(helper.CPWebCase):
# Here, q is the POUND SIGN U+00A3 encoded in utf8 and then %HEX
self.getPage(URI_TMPL.format(q=url_quote(europoundUtf8_2_bytes)))
# The return value will be encoded as utf8.
- self.assertBody(ntob('q: ') + europoundUtf8_2_bytes)
+ self.assertBody(b'q: ' + europoundUtf8_2_bytes)
# Query strings that are incorrectly encoded MUST raise 404.
# Here, q is the second byte of POUND SIGN U+A3 encoded in utf8
@@ -145,7 +145,7 @@ class EncodingTests(helper.CPWebCase):
def test_urlencoded_decoding(self):
# Test the decoding of an application/x-www-form-urlencoded entity.
europoundUtf8 = europoundUnicode.encode('utf-8')
- body = ntob('param=') + europoundUtf8
+ body = b'param=' + europoundUtf8
self.getPage('/',
method='POST',
headers=[
@@ -157,17 +157,17 @@ class EncodingTests(helper.CPWebCase):
# Encoded utf8 entities MUST be parsed and decoded correctly.
# Here, q is the POUND SIGN U+00A3 encoded in utf8
- body = ntob('q=\xc2\xa3')
+ body = b'q=\xc2\xa3'
self.getPage('/reqparams', method='POST',
headers=[(
'Content-Type', 'application/x-www-form-urlencoded'),
('Content-Length', str(len(body))),
],
body=body),
- self.assertBody(ntob('q: \xc2\xa3'))
+ self.assertBody(b'q: \xc2\xa3')
# ...and in utf16, which is not in the default attempt_charsets list:
- body = ntob('\xff\xfeq\x00=\xff\xfe\xa3\x00')
+ body = b'\xff\xfeq\x00=\xff\xfe\xa3\x00'
self.getPage('/reqparams',
method='POST',
headers=[
@@ -176,12 +176,12 @@ class EncodingTests(helper.CPWebCase):
('Content-Length', str(len(body))),
],
body=body),
- self.assertBody(ntob('q: \xc2\xa3'))
+ self.assertBody(b'q: \xc2\xa3')
# Entities that are incorrectly encoded MUST raise 400.
# Here, q is the POUND SIGN U+00A3 encoded in utf16, but
# the Content-Type incorrectly labels it utf-8.
- body = ntob('\xff\xfeq\x00=\xff\xfe\xa3\x00')
+ body = b'\xff\xfeq\x00=\xff\xfe\xa3\x00'
self.getPage('/reqparams',
method='POST',
headers=[
@@ -199,30 +199,30 @@ class EncodingTests(helper.CPWebCase):
def test_decode_tool(self):
# An extra charset should be tried first, and succeed if it matches.
# Here, we add utf-16 as a charset and pass a utf-16 body.
- body = ntob('\xff\xfeq\x00=\xff\xfe\xa3\x00')
+ body = b'\xff\xfeq\x00=\xff\xfe\xa3\x00'
self.getPage('/decode/extra_charset', method='POST',
headers=[(
'Content-Type', 'application/x-www-form-urlencoded'),
('Content-Length', str(len(body))),
],
body=body),
- self.assertBody(ntob('q: \xc2\xa3'))
+ self.assertBody(b'q: \xc2\xa3')
# An extra charset should be tried first, and continue to other default
# charsets if it doesn't match.
# Here, we add utf-16 as a charset but still pass a utf-8 body.
- body = ntob('q=\xc2\xa3')
+ body = b'q=\xc2\xa3'
self.getPage('/decode/extra_charset', method='POST',
headers=[(
'Content-Type', 'application/x-www-form-urlencoded'),
('Content-Length', str(len(body))),
],
body=body),
- self.assertBody(ntob('q: \xc2\xa3'))
+ self.assertBody(b'q: \xc2\xa3')
# An extra charset should error if force is True and it doesn't match.
# Here, we force utf-16 as a charset but still pass a utf-8 body.
- body = ntob('q=\xc2\xa3')
+ body = b'q=\xc2\xa3'
self.getPage('/decode/force_charset', method='POST',
headers=[(
'Content-Type', 'application/x-www-form-urlencoded'),
@@ -256,7 +256,7 @@ class EncodingTests(helper.CPWebCase):
('Content-Length', str(len(body))),
],
body=body),
- self.assertBody(ntob('submit: Create, text: ab\xe2\x80\x9cc'))
+ self.assertBody(b'submit: Create, text: ab\xe2\x80\x9cc')
@mock.patch('cherrypy._cpreqbody.Part.maxrambytes', 1)
def test_multipart_decoding_bigger_maxrambytes(self):
@@ -286,7 +286,7 @@ class EncodingTests(helper.CPWebCase):
('Content-Length', str(len(body))),
],
body=body),
- self.assertBody(ntob('submit: Create, text: \xe2\x80\x9c'))
+ self.assertBody(b'submit: Create, text: \xe2\x80\x9c')
def test_multipart_decoding_no_successful_charset(self):
# Test the decoding of a multipart entity when the charset (utf16) is
@@ -363,7 +363,7 @@ class EncodingTests(helper.CPWebCase):
def testGzip(self):
zbuf = io.BytesIO()
zfile = gzip.GzipFile(mode='wb', fileobj=zbuf, compresslevel=9)
- zfile.write(ntob('Hello, world'))
+ zfile.write(b'Hello, world')
zfile.close()
self.getPage('/gzip/', headers=[('Accept-Encoding', 'gzip')])
diff --git a/cherrypy/test/test_http.py b/cherrypy/test/test_http.py
index 1481492c..cbf10bb8 100644
--- a/cherrypy/test/test_http.py
+++ b/cherrypy/test/test_http.py
@@ -11,7 +11,7 @@ from six.moves.http_client import HTTPConnection
from six.moves import urllib
import cherrypy
-from cherrypy._cpcompat import HTTPSConnection, ntob
+from cherrypy._cpcompat import HTTPSConnection
from cherrypy.test import helper
@@ -106,7 +106,7 @@ class HTTPTests(helper.CPWebCase):
self.body = response.fp.read()
self.status = str(response.status)
self.assertStatus(200)
- self.assertBody(ntob('Hello world!'))
+ self.assertBody(b'Hello world!')
# Now send a message that has no Content-Length, but does send a body.
# Verify that CP times out the socket and responds
@@ -189,7 +189,7 @@ class HTTPTests(helper.CPWebCase):
# Test missing version in Request-Line
c = self.make_connection()
- c._output(ntob('GET /'))
+ c._output(b'geT /')
c._send_output()
if hasattr(c, 'strict'):
response = c.response_class(c.sock, strict=c.strict, method='GET')
@@ -199,7 +199,7 @@ class HTTPTests(helper.CPWebCase):
response = c.response_class(c.sock, method='GET')
response.begin()
self.assertEqual(response.status, 400)
- self.assertEqual(response.fp.read(22), ntob('Malformed Request-Line'))
+ self.assertEqual(response.fp.read(22), b'Malformed Request-Line')
c.close()
def test_request_line_split_issue_1220(self):
@@ -221,7 +221,7 @@ class HTTPTests(helper.CPWebCase):
c.putrequest('GET', '/')
c.putheader('Content-Type', 'text/plain')
# See https://github.com/cherrypy/cherrypy/issues/941
- c._output(ntob('Re, 1.2.3.4#015#012'))
+ c._output(b're, 1.2.3.4#015#012')
c.endheaders()
response = c.getresponse()
@@ -255,14 +255,14 @@ class HTTPTests(helper.CPWebCase):
def test_garbage_in(self):
# Connect without SSL regardless of server.scheme
c = HTTPConnection('%s:%s' % (self.interface(), self.PORT))
- c._output(ntob('gjkgjklsgjklsgjkljklsg'))
+ c._output(b'gjkgjklsgjklsgjkljklsg')
c._send_output()
response = c.response_class(c.sock, method='GET')
try:
response.begin()
self.assertEqual(response.status, 400)
self.assertEqual(response.fp.read(22),
- ntob('Malformed Request-Line'))
+ b'Malformed Request-Line')
c.close()
except socket.error:
e = sys.exc_info()[1]
diff --git a/cherrypy/test/test_httpauth.py b/cherrypy/test/test_httpauth.py
index 3a5cff27..eed3666c 100644
--- a/cherrypy/test/test_httpauth.py
+++ b/cherrypy/test/test_httpauth.py
@@ -45,7 +45,7 @@ class HTTPAuthTest(helper.CPWebCase):
return sha1(ntob(password)).hexdigest()
def fetch_password(username):
- return sha1(ntob('test')).hexdigest()
+ return sha1(b'test').hexdigest()
conf = {
'/digest': {
@@ -57,7 +57,7 @@ class HTTPAuthTest(helper.CPWebCase):
'tools.basic_auth.on': True,
'tools.basic_auth.realm': 'localhost',
'tools.basic_auth.users': {
- 'test': md5(ntob('test')).hexdigest()
+ 'test': md5(b'test').hexdigest()
}
},
'/basic2': {
diff --git a/cherrypy/test/test_logging.py b/cherrypy/test/test_logging.py
index 4d686775..c4948c20 100644
--- a/cherrypy/test/test_logging.py
+++ b/cherrypy/test/test_logging.py
@@ -6,7 +6,7 @@ from unittest import mock
import six
import cherrypy
-from cherrypy._cpcompat import ntob, ntou
+from cherrypy._cpcompat import ntou
from cherrypy.test import helper, logtest
localDir = os.path.dirname(__file__)
@@ -177,7 +177,7 @@ class AccessLogTests(helper.CPWebCase, logtest.LogCase):
self.getPage('/slashes')
self.assertStatus(200)
if six.PY3:
- self.assertLog(-1, ntob('"GET /slashed\\path HTTP/1.1"'))
+ self.assertLog(-1, b'"GET /slashed\\path HTTP/1.1"')
else:
self.assertLog(-1, r'"GET /slashed\\path HTTP/1.1"')
diff --git a/cherrypy/test/test_mime.py b/cherrypy/test/test_mime.py
index 6f5987c1..ef35d10e 100644
--- a/cherrypy/test/test_mime.py
+++ b/cherrypy/test/test_mime.py
@@ -1,7 +1,7 @@
"""Tests for various MIME issues, including the safe_multipart Tool."""
import cherrypy
-from cherrypy._cpcompat import ntob, ntou
+from cherrypy._cpcompat import ntou
from cherrypy.test import helper
@@ -107,28 +107,28 @@ class SafeMultipartHandlingTest(helper.CPWebCase):
('Connection', 'Keep-Alive'),
('Cache-Control', 'no-cache'),
]
- filedata = ntob('<?xml version="1.0" encoding="UTF-8"?>\r\n'
- '<projectDescription>\r\n'
- '</projectDescription>\r\n')
- body = (ntob(
- '------------KM7Ij5cH2KM7Ef1gL6ae0ae0cH2gL6\r\n'
- 'Content-Disposition: form-data; name="Filename"\r\n'
- '\r\n'
- '.project\r\n'
- '------------KM7Ij5cH2KM7Ef1gL6ae0ae0cH2gL6\r\n'
- 'Content-Disposition: form-data; '
- 'name="Filedata"; filename=".project"\r\n'
- 'Content-Type: application/octet-stream\r\n'
- '\r\n') +
+ filedata = (b'<?xml version="1.0" encoding="UTF-8"?>\r\n'
+ b'<projectDescription>\r\n'
+ b'</projectDescription>\r\n')
+ body = (
+ b'------------KM7Ij5cH2KM7Ef1gL6ae0ae0cH2gL6\r\n'
+ b'Content-Disposition: form-data; name="Filename"\r\n'
+ b'\r\n'
+ b'.project\r\n'
+ b'------------KM7Ij5cH2KM7Ef1gL6ae0ae0cH2gL6\r\n'
+ b'Content-Disposition: form-data; '
+ b'name="Filedata"; filename=".project"\r\n'
+ b'Content-Type: application/octet-stream\r\n'
+ b'\r\n' +
filedata +
- ntob('\r\n'
- '------------KM7Ij5cH2KM7Ef1gL6ae0ae0cH2gL6\r\n'
- 'Content-Disposition: form-data; name="Upload"\r\n'
- '\r\n'
- 'Submit Query\r\n'
- # Flash apps omit the trailing \r\n on the last line:
- '------------KM7Ij5cH2KM7Ef1gL6ae0ae0cH2gL6--'
- ))
+ b'\r\n'
+ b'------------KM7Ij5cH2KM7Ef1gL6ae0ae0cH2gL6\r\n'
+ b'Content-Disposition: form-data; name="Upload"\r\n'
+ b'\r\n'
+ b'Submit Query\r\n'
+ # Flash apps omit the trailing \r\n on the last line:
+ b'------------KM7Ij5cH2KM7Ef1gL6ae0ae0cH2gL6--'
+ )
self.getPage('/flashupload', headers, 'POST', body)
self.assertBody('Upload: Submit Query, Filename: .project, '
'Filedata: %r' % filedata)
diff --git a/cherrypy/test/test_request_obj.py b/cherrypy/test/test_request_obj.py
index 232440c9..6b93e13d 100644
--- a/cherrypy/test/test_request_obj.py
+++ b/cherrypy/test/test_request_obj.py
@@ -10,7 +10,7 @@ import six
from six.moves.http_client import IncompleteRead
import cherrypy
-from cherrypy._cpcompat import ntob, ntou
+from cherrypy._cpcompat import ntou
from cherrypy.lib import httputil
from cherrypy.test import helper
@@ -728,14 +728,14 @@ class RequestObjectTests(helper.CPWebCase):
self.getPage('/headers/ifmatch',
[('If-Match', ntou('=?utf-8?q?%s?=') % c)])
# The body should be utf-8 encoded.
- self.assertBody(ntob('\xe2\x84\xabngstr\xc3\xb6m'))
+ self.assertBody(b'\xe2\x84\xabngstr\xc3\xb6m')
# But the Etag header should be RFC-2047 encoded (binary)
self.assertHeader('ETag', ntou('=?utf-8?b?4oSrbmdzdHLDtm0=?='))
# Test a *LONG* RFC-2047-encoded request and response header value
self.getPage('/headers/ifmatch',
[('If-Match', ntou('=?utf-8?q?%s?=') % (c * 10))])
- self.assertBody(ntob('\xe2\x84\xabngstr\xc3\xb6m') * 10)
+ self.assertBody(b'\xe2\x84\xabngstr\xc3\xb6m' * 10)
# Note: this is different output for Python3, but it decodes fine.
etag = self.assertHeader(
'ETag',
@@ -771,7 +771,7 @@ class RequestObjectTests(helper.CPWebCase):
self.assertBody('')
elif m == 'TRACE':
# Some HTTP servers (like modpy) have their own TRACE support
- self.assertEqual(self.body[:5], ntob('TRACE'))
+ self.assertEqual(self.body[:5], b'TRACE')
else:
self.assertBody(m)
@@ -791,7 +791,7 @@ class RequestObjectTests(helper.CPWebCase):
# Request a PATCH method with a file body but no Content-Type.
# See https://github.com/cherrypy/cherrypy/issues/790.
- b = ntob('one thing on top of another')
+ b = b'one thing on top of another'
self.persistent = True
try:
conn = self.HTTP_CONN
@@ -831,7 +831,7 @@ class RequestObjectTests(helper.CPWebCase):
# Request a PUT method with a file body but no Content-Type.
# See https://github.com/cherrypy/cherrypy/issues/790.
- b = ntob('one thing on top of another')
+ b = b'one thing on top of another'
self.persistent = True
try:
conn = self.HTTP_CONN
@@ -929,4 +929,4 @@ class RequestObjectTests(helper.CPWebCase):
for x in range(20):
self.getPage('/threadlocal/')
results.append(self.body)
- self.assertEqual(results, [ntob('None')] * 20)
+ self.assertEqual(results, [b'None'] * 20)
diff --git a/cherrypy/test/test_tools.py b/cherrypy/test/test_tools.py
index 4e7b83f1..a73a3898 100644
--- a/cherrypy/test/test_tools.py
+++ b/cherrypy/test/test_tools.py
@@ -14,7 +14,7 @@ from six.moves.http_client import IncompleteRead
import cherrypy
from cherrypy import tools
-from cherrypy._cpcompat import ntob, ntou
+from cherrypy._cpcompat import ntou
from cherrypy.test import helper, _test_decorators
@@ -75,15 +75,15 @@ class ToolTests(helper.CPWebCase):
def nadsat(self):
def nadsat_it_up(body):
for chunk in body:
- chunk = chunk.replace(ntob('good'), ntob('horrorshow'))
- chunk = chunk.replace(ntob('piece'), ntob('lomtick'))
+ chunk = chunk.replace(b'good', b'horrorshow')
+ chunk = chunk.replace(b'piece', b'lomtick')
yield chunk
cherrypy.response.body = nadsat_it_up(cherrypy.response.body)
nadsat.priority = 0
def cleanup(self):
# This runs after the request has been completely written out.
- cherrypy.response.body = [ntob('razdrez')]
+ cherrypy.response.body = [b'razdrez']
id = cherrypy.request.params.get('id')
if id:
self.ended[id] = True
@@ -139,8 +139,8 @@ class ToolTests(helper.CPWebCase):
def tarfile(self):
actual = cherrypy.request.config.get('tools.streamer.arg')
assert actual == 'arg value'
- cherrypy.response.output.write(ntob('I am '))
- cherrypy.response.output.write(ntob('a tarfile'))
+ cherrypy.response.output.write(b'I am ')
+ cherrypy.response.output.write(b'a tarfile')
@cherrypy.expose
def euro(self):
@@ -226,7 +226,7 @@ class ToolTests(helper.CPWebCase):
# Declare Tools in detached config
'/demo': {
'tools.numerify.on': True,
- 'tools.numerify.map': {ntob('pie'): ntob('3.14159')},
+ 'tools.numerify.map': {b'pie': b'3.14159'},
},
'/demo/restricted': {
'request.show_tracebacks': False,
diff --git a/cherrypy/test/test_wsgi_ns.py b/cherrypy/test/test_wsgi_ns.py
index 2a5fedd4..3545724c 100644
--- a/cherrypy/test/test_wsgi_ns.py
+++ b/cherrypy/test/test_wsgi_ns.py
@@ -1,5 +1,4 @@
import cherrypy
-from cherrypy._cpcompat import ntob
from cherrypy.test import helper
@@ -76,8 +75,8 @@ class WSGI_Namespace_Test(helper.CPWebCase):
return 'HellO WoRlD!'
root_conf = {'wsgi.pipeline': [('replace', Replacer)],
- 'wsgi.replace.map': {ntob('L'): ntob('X'),
- ntob('l'): ntob('r')},
+ 'wsgi.replace.map': {b'L': b'X',
+ b'l': b'r'},
}
app = cherrypy.Application(Root())
diff --git a/cherrypy/test/test_wsgiapps.py b/cherrypy/test/test_wsgiapps.py
index fa7f25f7..1b3bf28f 100644
--- a/cherrypy/test/test_wsgiapps.py
+++ b/cherrypy/test/test_wsgiapps.py
@@ -27,7 +27,7 @@ class WSGIGraftTests(helper.CPWebCase):
response_headers = [('Content-type', 'text/plain')]
start_response(status, response_headers)
return [
- ntob('Hello'), ntob(''), ntob(' '), ntob(''), ntob('world')
+ b'Hello', b'', b' ', b'', b'world',
]
class WSGIResponse(object):