From c8cf2256655ee4b34ec501325b9016608b5cce5f Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 15 Jan 2009 00:20:04 +0000 Subject: - Instead of invariably using ``webob.Request`` as the "request factory" (e.g. in the ``Router`` class) and ``webob.Response`` and the "response factory" (e.g. in ``render_template_to_response``), allow both to be overridden via a ZCML utility hook. See the "Using ZCML Hooks" chapter of the documentation for more information. --- repoze/bfg/tests/test_view.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'repoze/bfg/tests/test_view.py') diff --git a/repoze/bfg/tests/test_view.py b/repoze/bfg/tests/test_view.py index 389c00cc5..6f16da28e 100644 --- a/repoze/bfg/tests/test_view.py +++ b/repoze/bfg/tests/test_view.py @@ -468,6 +468,22 @@ class TestStaticView(unittest.TestCase, BaseTest): filedata = open(os.path.join(static_dir, '__init__.py')).read() self.assertEqual(result, filedata) + def test_it_with_alternate_iresponsefactory(self): + view = self._makeOne() + context = DummyContext() + request = DummyRequest() + request.subpath = ['__init__.py'] + request.environ = self._makeEnviron() + from repoze.bfg.interfaces import IResponseFactory + from zope.component import getGlobalSiteManager + gsm = getGlobalSiteManager() + from webob import Response + class Response2(Response): + pass + gsm.registerUtility(Response2, IResponseFactory) + response = view(context, request) + self.failUnless(isinstance(response, Response2)) + class DummyContext: pass -- cgit v1.2.3