Chris McDonough
2013-09-09 780bbf9998fd805df55499ef4a78f41cbf99c7de
- Removed the ``pyramid.view.is_response`` function that had been deprecated
since Pyramid 1.1. Use the ``pyramid.request.Request.is_response`` method
instead.
4 files modified
68 ■■■■■ changed files
CHANGES.txt 4 ●●●● patch | view | raw | blame | history
docs/api/view.rst 2 ●●●●● patch | view | raw | blame | history
pyramid/tests/test_view.py 45 ●●●●● patch | view | raw | blame | history
pyramid/view.py 17 ●●●●● patch | view | raw | blame | history
CHANGES.txt
@@ -77,6 +77,10 @@
  since Pyramid 1.1.  Instead use ``pyramid.static.static_view`` with
  ``use_subpath=True`` argument.
- Removed the ``pyramid.view.is_response`` function that had been deprecated
  since Pyramid 1.1.  Use the ``pyramid.request.Request.is_response`` method
  instead.
1.5a1 (2013-08-30)
==================
docs/api/view.rst
@@ -11,8 +11,6 @@
  .. autofunction:: render_view
  .. autofunction:: is_response
  .. autoclass:: view_config
     :members:
pyramid/tests/test_view.py
@@ -301,51 +301,6 @@
        s = self._callFUT(context, request, name='registered', secure=False)
        self.assertEqual(s, b'anotherview')
class TestIsResponse(unittest.TestCase):
    def setUp(self):
        from zope.deprecation import __show__
        __show__.off()
    def tearDown(self):
        from zope.deprecation import __show__
        __show__.on()
    def _callFUT(self, *arg, **kw):
        from pyramid.view import is_response
        return is_response(*arg, **kw)
    def test_is(self):
        response = DummyResponse()
        self.assertEqual(self._callFUT(response), True)
    def test_isnt(self):
        response = None
        self.assertEqual(self._callFUT(response), False)
    def test_isnt_no_headerlist(self):
        class Response(object):
            pass
        resp = Response
        resp.status = '200 OK'
        resp.app_iter = []
        self.assertEqual(self._callFUT(resp), False)
    def test_isnt_no_status(self):
        class Response(object):
            pass
        resp = Response
        resp.app_iter = []
        resp.headerlist = ()
        self.assertEqual(self._callFUT(resp), False)
    def test_isnt_no_app_iter(self):
        class Response(object):
            pass
        resp = Response
        resp.status = '200 OK'
        resp.headerlist = ()
        self.assertEqual(self._callFUT(resp), False)
class TestViewConfigDecorator(unittest.TestCase):
    def setUp(self):
        testing.setUp()
pyramid/view.py
@@ -1,8 +1,6 @@
import venusian
from zope.interface import providedBy
from zope.deprecation import deprecated
from pyramid.interfaces import (
    IRoutesMapper,
@@ -407,18 +405,3 @@
        settings['_info'] = info.codeinfo # fbo "action_method"
        return wrapped
    
def is_response(ob):
    """ Return ``True`` if ``ob`` implements the interface implied by
    :ref:`the_response`. ``False`` if not.
    .. deprecated:: 1.1
       use :func:`pyramid.request.Request.is_response` instead"""
    if ( hasattr(ob, 'app_iter') and hasattr(ob, 'headerlist') and
         hasattr(ob, 'status') ):
        return True
    return False
deprecated(
    'is_response',
    'pyramid.view.is_response is deprecated as of Pyramid 1.1.  Use '
    'pyramid.request.Request.is_response instead.')