diff options
| author | Michael Merickel <michael@merickel.org> | 2012-11-13 21:44:26 -0600 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2012-11-13 21:44:26 -0600 |
| commit | 0a8ea94e81e3edc68d8175eb3666a7bfc9904913 (patch) | |
| tree | 12a3b516e8e47f4585e662016df9d1b8334bcc38 | |
| parent | e35b16b028bd7c6781c316a0858b705f3745ba71 (diff) | |
| download | pyramid-0a8ea94e81e3edc68d8175eb3666a7bfc9904913.tar.gz pyramid-0a8ea94e81e3edc68d8175eb3666a7bfc9904913.tar.bz2 pyramid-0a8ea94e81e3edc68d8175eb3666a7bfc9904913.zip | |
simplfied change as response.app_iter must contain bytes per pep 3333
| -rw-r--r-- | pyramid/tests/test_view.py | 7 | ||||
| -rw-r--r-- | pyramid/view.py | 3 |
2 files changed, 5 insertions, 5 deletions
diff --git a/pyramid/tests/test_view.py b/pyramid/tests/test_view.py index 42cfea37b..a78b0cbab 100644 --- a/pyramid/tests/test_view.py +++ b/pyramid/tests/test_view.py @@ -224,12 +224,13 @@ class RenderViewToIterableTests(BaseTest, unittest.TestCase): response = DummyResponse() view = make_view(response) def anotherview(context, request): - return DummyResponse('anotherview') + return DummyResponse(b'anotherview') view.__call_permissive__ = anotherview self._registerView(request.registry, view, 'registered') iterable = self._callFUT(context, request, name='registered', secure=False) - self.assertEqual(iterable, ['anotherview']) + self.assertEqual(iterable, [b'anotherview']) + def test_verify_output_bytestring(self): from pyramid.request import Request from pyramid.config import Configurator @@ -294,7 +295,7 @@ class RenderViewTests(BaseTest, unittest.TestCase): response = DummyResponse() view = make_view(response) def anotherview(context, request): - return DummyResponse('anotherview') + return DummyResponse(b'anotherview') view.__call_permissive__ = anotherview self._registerView(request.registry, view, 'registered') s = self._callFUT(context, request, name='registered', secure=False) diff --git a/pyramid/view.py b/pyramid/view.py index 972877fea..dd01d9d20 100644 --- a/pyramid/view.py +++ b/pyramid/view.py @@ -2,7 +2,6 @@ import venusian from zope.interface import providedBy from zope.deprecation import deprecated -from webob.compat import text_type from pyramid.interfaces import ( @@ -138,7 +137,7 @@ def render_view(context, request, name='', secure=True): iterable = render_view_to_iterable(context, request, name, secure) if iterable is None: return None - return b''.join((x.encode('utf-8') if isinstance(x, text_type) else x for x in iterable)) + return b''.join(iterable) class view_config(object): """ A function, class or method :term:`decorator` which allows a |
