Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion paste/cgiapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def proc_communicate(proc, stdin=None, stdout=None, stderr=None):
read_set.remove(proc.stderr)
if trans_nl:
data = proc._translate_newlines(data)
stderr.write(data)
stderr.write(six.ensure_text(data))

try:
proc.wait()
Expand Down
2 changes: 0 additions & 2 deletions paste/errordocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ def keep_status_start_response(status, headers, exc_info=None):
return self.app(environ, keep_status_start_response)
except RecursionLoop as e:
line = 'Recursion error getting error page: %s\n' % e
if six.PY3:
line = line.encode('utf8')
environ['wsgi.errors'].write(line)
keep_status_start_response('500 Server Error', [('Content-type', 'text/plain')], sys.exc_info())
body = ('Error: %s. (Error page could not be fetched)'
Expand Down
2 changes: 0 additions & 2 deletions paste/evalexception/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,6 @@ def detect_start_response(status, headers, exc_info=None):
headers,
exc_info)
msg = 'Debug at: %s\n' % view_uri
if six.PY3:
msg = msg.encode('utf8')
environ['wsgi.errors'].write(msg)

exc_data = collector.collect_exception(*exc_info)
Expand Down
4 changes: 1 addition & 3 deletions paste/exceptions/errormiddleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def next(self):
if self.closed:
raise StopIteration
try:
return self.app_iterator.next()
return next(self.app_iterator)
except StopIteration:
self.closed = True
close_response = self._close()
Expand Down Expand Up @@ -386,8 +386,6 @@ def handle_exception(exc_info, error_stream, html=True,
else:
line = ('Error - %s: %s\n'
% (exc_data.exception_type, exc_data.exception_value))
if six.PY3:
line = line.encode('utf8')
error_stream.write(line)
if html:
if debug_mode and simple_html_error:
Expand Down
2 changes: 1 addition & 1 deletion paste/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def __init__(self, wsgi_errors):
self.errors = wsgi_errors

def write(self, s):
assert isinstance(s, bytes)
assert isinstance(s, six.string_types)
self.errors.write(s)

def flush(self):
Expand Down
3 changes: 1 addition & 2 deletions paste/wsgilib.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def raw_interactive(application, path='', raise_on_wsgi_error=False,
if raise_on_wsgi_error:
errors = ErrorRaiser()
else:
errors = six.BytesIO()
errors = six.StringIO()
basic_environ = {
# mandatory CGI variables
'REQUEST_METHOD': 'GET', # always mandatory
Expand Down Expand Up @@ -604,4 +604,3 @@ def replacement(*args, **kw):
if __name__ == '__main__':
import doctest
doctest.testmod()

3 changes: 1 addition & 2 deletions tests/test_cgiapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,4 @@ def test_stderr():
res = app.get('', expect_errors=True)
assert res.status == 500
assert 'error' in res
assert b'some data' in res.errors

assert 'some data' in res.errors