From cfd4e5e06d05dac3e8f1c03b63bc3cf37242334a Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 25 Jan 2009 02:30:46 +0000 Subject: - You can now override the NotFound and Unauthorized responses that :mod:`repoze.bfg` generates when a view cannot be found or cannot be invoked due to lack of permission. See the "ZCML Hooks" chapter in the docs for more information. - Use a homegrown Unauthorized error instead of ``webob.exc.Unauthorized`` (the latter is slow). - Various speed micro-tweaks. --- repoze/bfg/interfaces.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'repoze/bfg/interfaces.py') diff --git a/repoze/bfg/interfaces.py b/repoze/bfg/interfaces.py index 58a0e3257..595bce5c8 100644 --- a/repoze/bfg/interfaces.py +++ b/repoze/bfg/interfaces.py @@ -1,14 +1,10 @@ from zope.interface import Attribute from zope.interface import Interface -from zope.interface import implements from zope.deferredimport import deprecated from zope.component.interfaces import IObjectEvent -from webob import Request as WebobRequest - - deprecated( '(repoze.bfg.interfaces.ITemplate should now be imported ' 'as repoze.bfg.interfaces.ITemplateRenderer)', @@ -34,9 +30,9 @@ deprecated( ) class IRequestFactory(Interface): - """ A utility which generates a request factory """ + """ A utility which generates a request object """ def __call__(): - """ Return a request factory (e.g. a callable that accepts an + """ Return a request factory (a callable that accepts an environ and returns an object implementing IRequest, e.g. ``webob.Request``)""" @@ -191,3 +187,20 @@ 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 IUnauthorizedAppFactory(Interface): + """ A utility which returns an Unauthorized WSGI application + factory""" + def __call__(): + """ Return a callable which returns an unauthorized WSGI + application. When the WSGI application is invoked, a + ``message`` key in the WSGI environ provides information + pertaining to the reason for the unauthorized.""" + -- cgit v1.2.3