diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-05-31 02:17:28 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-05-31 02:17:28 +0000 |
| commit | 964b7852d997f6c4aa4b04d54f2847095e4461e8 (patch) | |
| tree | c03d316200f371f04e1c2c4618d64f860c808ed3 /repoze | |
| parent | af8cbacc5466fcf9eae84564b0fa891892a986bf (diff) | |
| download | pyramid-964b7852d997f6c4aa4b04d54f2847095e4461e8.tar.gz pyramid-964b7852d997f6c4aa4b04d54f2847095e4461e8.tar.bz2 pyramid-964b7852d997f6c4aa4b04d54f2847095e4461e8.zip | |
- Renamed ``repoze.bfg.interfaces.IForbiddenResponseFactory`` to
``repoze.bfg.interfaces.IForbiddenView``.
Diffstat (limited to 'repoze')
| -rw-r--r-- | repoze/bfg/interfaces.py | 18 | ||||
| -rw-r--r-- | repoze/bfg/router.py | 9 | ||||
| -rw-r--r-- | repoze/bfg/tests/test_router.py | 6 |
3 files changed, 16 insertions, 17 deletions
diff --git a/repoze/bfg/interfaces.py b/repoze/bfg/interfaces.py index bc91c6b0e..8316c58bc 100644 --- a/repoze/bfg/interfaces.py +++ b/repoze/bfg/interfaces.py @@ -169,15 +169,7 @@ class IContextNotFound(Interface): """ Interface implemented by contexts generated by code which cannot find a context during root finding or traversal """ -class INotFoundAppFactory(Interface): - """ A utility which returns a NotFound WSGI application factory """ - def __call__(): - """ Return a callable which returns a notfound WSGI - application. When the WSGI application is invoked, - a``message`` key in the WSGI environ provides information - pertaining to the reason for the notfound.""" - -class IForbiddenResponseFactory(Interface): +class IForbiddenView(Interface): """ A utility which returns an IResponse as the result of the denial of a view invocation by a security policy.""" def __call__(context, request): @@ -192,6 +184,14 @@ class IForbiddenResponseFactory(Interface): repoze.bfg router during traversal or url dispatch. The ``request`` will be the request object which caused the deny.""" +class INotFoundAppFactory(Interface): + """ A utility which returns a NotFound WSGI application factory """ + def __call__(): + """ Return a callable which returns a notfound WSGI + application. When the WSGI application is invoked, + a``message`` key in the WSGI environ provides information + pertaining to the reason for the notfound.""" + class IUnauthorizedAppFactory(Interface): """ A utility which returns an Unauthorized WSGI application factory (deprecated in repoze.bfg 0.8.2) in favor of diff --git a/repoze/bfg/router.py b/repoze/bfg/router.py index 8549c63da..6e6477be1 100644 --- a/repoze/bfg/router.py +++ b/repoze/bfg/router.py @@ -23,7 +23,7 @@ from repoze.bfg.interfaces import IRootFactory from repoze.bfg.interfaces import IRouter from repoze.bfg.interfaces import IRoutesMapper from repoze.bfg.interfaces import ISettings -from repoze.bfg.interfaces import IForbiddenResponseFactory +from repoze.bfg.interfaces import IForbiddenView from repoze.bfg.interfaces import IUnauthorizedAppFactory from repoze.bfg.interfaces import IView from repoze.bfg.interfaces import IViewPermission @@ -78,20 +78,19 @@ class Router(object): 'Instead of registering a utility against the ' 'repoze.bfg.interfaces.IUnauthorizedAppFactory interface ' 'to return a custom forbidden response, you should now ' - 'register a "repoze.interfaces.IForbiddenResponseFactory". ' + 'register a "repoze.interfaces.IForbiddenView". ' 'The IUnauthorizedAppFactory interface was deprecated in ' 'repoze.bfg 0.9 and will be removed in a subsequent version ' 'of repoze.bfg. See the "Hooks" chapter of the repoze.bfg ' 'documentation for more information about ' - 'IForbiddenResponseFactory.') + 'IForbiddenView.') self.logger and self.logger.warn(warning) def forbidden(context, request): app = unauthorized_app_factory() response = request.get_response(app) return response - forbidden = registry.queryUtility(IForbiddenResponseFactory, - default=forbidden) + forbidden = registry.queryUtility(IForbiddenView, default=forbidden) self.forbidden_resp_factory = forbidden or default_forbidden_view diff --git a/repoze/bfg/tests/test_router.py b/repoze/bfg/tests/test_router.py index 9a29967a3..86d7d12cf 100644 --- a/repoze/bfg/tests/test_router.py +++ b/repoze/bfg/tests/test_router.py @@ -137,10 +137,10 @@ class RouterTests(unittest.TestCase): self.assertEqual(router.notfound_app_factory, app) def test_iforbidden_responsefactory_override(self): - from repoze.bfg.interfaces import IForbiddenResponseFactory + from repoze.bfg.interfaces import IForbiddenView def app(): """ """ - self.registry.registerUtility(app, IForbiddenResponseFactory) + self.registry.registerUtility(app, IForbiddenView) self._registerRootFactory(None) router = self._makeOne() self.assertEqual(router.forbidden_resp_factory, app) @@ -164,7 +164,7 @@ class RouterTests(unittest.TestCase): self.registry.registerUtility(factory, IUnauthorizedAppFactory) router = self._makeOne() self.assertEqual(len(logger.messages), 1) - self.failUnless('IForbiddenResponseFactory' in logger.messages[0]) + self.failUnless('IForbiddenView' in logger.messages[0]) class DummyRequest: def get_response(self, app): return app |
