summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorianb <devnull@localhost>2008-03-26 02:54:07 +0000
committerianb <devnull@localhost>2008-03-26 02:54:07 +0000
commitb0d7f9375fcce4f514fb41eab767ccb1d6b93f03 (patch)
tree42e6b73ca04855da24f2a7bf957058423cbd63cf
parentfe678eb753629f27048e6fd8986e5db010fc5a7c (diff)
downloadpaste-b0d7f9375fcce4f514fb41eab767ccb1d6b93f03.tar.gz
Unicode TestApp Response __contains__ test works (#235)
-rw-r--r--docs/news.txt4
-rw-r--r--paste/fixture.py3
2 files changed, 7 insertions, 0 deletions
diff --git a/docs/news.txt b/docs/news.txt
index b523abb..481a155 100644
--- a/docs/news.txt
+++ b/docs/news.txt
@@ -34,6 +34,10 @@ svn trunk
* ``paste.fixture.TestApp`` can store multiple cookie values
(previously only one cookie was stored; from Andrey Lebedev)
+* ``u'' in TestApp(app).get('/')`` will work when the body isn't ASCII
+ (before it would give a unicode error). This problem wasn't present
+ in the recommended `WebTest <http://pythonpaste.org/webtest/>`_.
+
1.6.1
-----
diff --git a/paste/fixture.py b/paste/fixture.py
index 8c569f7..38b9d24 100644
--- a/paste/fixture.py
+++ b/paste/fixture.py
@@ -792,6 +792,9 @@ class TestResponse(object):
"""
if not isinstance(s, (str, unicode)):
s = str(s)
+ if isinstance(s, unicode):
+ ## FIXME: we don't know that this response uses utf8:
+ s = s.encode('utf8')
return (self.body.find(s) != -1
or self.normal_body.find(s) != -1)