Skip to content

Commit

Permalink
fix str(Response()) w/o charset, but only on py2
Browse files Browse the repository at this point in the history
  • Loading branch information
maluke committed Oct 1, 2011
1 parent e186436 commit 919c36d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ Session.vim
coverage.xml
nosetests.xml
env32/

_website/
1 change: 0 additions & 1 deletion tests/test_in_wsgiref.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import with_statement
import sys
import logging
import threading
Expand Down
2 changes: 2 additions & 0 deletions tests/test_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ def test_from_file():
res = Response('test')
inp = io.BytesIO(bytes_(str(res)))
equal_resp(res, inp)

def test_from_file2():
res = Response(app_iter=iter([b'test ', b'body']),
content_type='text/plain')
inp = io.BytesIO(bytes_(str(res)))
Expand Down
3 changes: 1 addition & 2 deletions webob/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,9 @@ def __str__(self, skip_body=False):
self.body
parts += map('%s: %s'.__mod__, self.headerlist)
if not skip_body and self.body:
parts += ['', self.text]
parts += ['', self.text if PY3 else self.body]
return '\n'.join(parts)


#
# status, status_int
#
Expand Down

0 comments on commit 919c36d

Please sign in to comment.