From d634951d17e48cf1fb26e58348ec3b86daef1466 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 24 Jan 2010 16:27:29 +0000 Subject: 100% test coverage. --- repoze/bfg/configuration.py | 7 ++----- repoze/bfg/tests/test_zcml.py | 9 +++++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/repoze/bfg/configuration.py b/repoze/bfg/configuration.py index dae1afe2a..2fff1054c 100644 --- a/repoze/bfg/configuration.py +++ b/repoze/bfg/configuration.py @@ -736,13 +736,10 @@ class Configurator(object): context = for_ r_context = context - r_request_iface = request_iface if r_context is None: r_context = Interface if not IInterface.providedBy(r_context): r_context = implementedBy(r_context) - if not IInterface.providedBy(r_request_iface): - r_request_iface = implementedBy(r_request_iface) registered = self.registry.adapters.registered @@ -767,7 +764,7 @@ class Configurator(object): old_view = None for view_type in (IView, ISecuredView, IMultiView): - old_view = registered((r_request_iface, r_context), view_type, name) + old_view = registered((request_iface, r_context), view_type, name) if old_view is not None: break @@ -799,7 +796,7 @@ class Configurator(object): for view_type in (IView, ISecuredView): # unregister any existing views self.registry.adapters.unregister( - (r_request_iface, r_context), view_type, name=name) + (request_iface, r_context), view_type, name=name) self.registry.registerAdapter(multiview, (request_iface, context), IMultiView, name, info=_info) diff --git a/repoze/bfg/tests/test_zcml.py b/repoze/bfg/tests/test_zcml.py index 4d29c8373..2d9d59b64 100644 --- a/repoze/bfg/tests/test_zcml.py +++ b/repoze/bfg/tests/test_zcml.py @@ -69,6 +69,15 @@ class TestViewDirective(unittest.TestCase): self.assertEqual(result, 'OK') self.failIf(hasattr(view, '__call_permissive__')) + def test_request_type_asnoninterfacestring(self): + from repoze.bfg.exceptions import ConfigurationError + context = DummyContext('notaninterface') + view = lambda *arg: 'OK' + self.assertRaises(ConfigurationError, + self._callFUT, + context, 'repoze.view', IDummy, view=view, + request_type='whatever') + def test_with_dotted_renderer(self): from repoze.bfg.threadlocal import get_current_registry from repoze.bfg.interfaces import IView -- cgit v1.2.3