From 1c02105e4fce880bca80e58be3191d2e1368596a Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 19 Nov 2009 18:21:09 +0000 Subject: - Each of the ``repoze.bfg.view.render_view``, ``repoze.bfg.view.render_view_to_iterable``, ``repoze.bfg.view.render_view_to_response``, ``repoze.bfg.view.append_slash_notfound_view``, ``repoze.bfg.view.default_notfound_view``, ``repoze.bfg.view.default_forbidden_view``, and the ``repoze.bfg.configuration.rendered_response`` functions now expects to be called with a request object that has a ``registry`` attribute which represents the current ZCA registry. This should only be a problem when passing a custom request object to code which ends up calling these functions in a unit test. To retrofit tests that end up calling these functions which expect to be able to use a non-registry-aware request object, use the ``repoze.bfg.threadlocal.get_current_request`` API in the test to create the request; this will return a ``repoze.bfg.testing.DummyRequest`` that has the current registry as its ``registry`` attribute. Alternatively, use the ``repoze.bfg.threadlocal.get_current_registry`` API: call this function and add an attribute to your unit test request object named ``registry`` with the result. - The ``repoze.bfg.view.derive_view`` callable has been removed. Use ``repoze.bfg.configuration.Configurator.derive_view`` instead (still not an API, however). --- repoze/bfg/tests/test_integration.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'repoze/bfg/tests/test_integration.py') diff --git a/repoze/bfg/tests/test_integration.py b/repoze/bfg/tests/test_integration.py index 57d22c286..9175efe4c 100644 --- a/repoze/bfg/tests/test_integration.py +++ b/repoze/bfg/tests/test_integration.py @@ -96,10 +96,9 @@ class TestGrokkedApp(unittest.TestCase): cleanUp() def test_it(self): + from repoze.bfg.threadlocal import get_current_request from repoze.bfg.view import render_view_to_response - from zope.interface import directlyProvides from repoze.bfg.zcml import zcml_configure - from repoze.bfg.interfaces import IRequest import repoze.bfg.tests.grokkedapp as package actions = zcml_configure('configure.zcml', package) @@ -109,7 +108,7 @@ class TestGrokkedApp(unittest.TestCase): ctx = DummyContext() req = DummyRequest() - directlyProvides(req, IRequest) + req = get_current_request() req.method = 'GET' result = render_view_to_response(ctx, req, '') -- cgit v1.2.3