From d66bfb5d1f1aef5cce4941b49740dbd136c95605 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 6 Sep 2009 03:36:59 +0000 Subject: Merge multiview2 branch to HEAD. --- repoze/bfg/interfaces.py | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'repoze/bfg/interfaces.py') diff --git a/repoze/bfg/interfaces.py b/repoze/bfg/interfaces.py index 779c0ef03..6a999a98c 100644 --- a/repoze/bfg/interfaces.py +++ b/repoze/bfg/interfaces.py @@ -6,20 +6,9 @@ from zope.component.interfaces import IObjectEvent class IRequest(Interface): """ Request type interface attached to all request objects """ -class IPOSTRequest(IRequest): - """ Request type interface attached to POST requests""" - -class IGETRequest(IRequest): - """ Request type interface attached to GET requests""" - -class IPUTRequest(IRequest): - """ Request type interface attached to PUT requests""" - -class IDELETERequest(IRequest): - """ Request type interface attached to DELETE requests""" - -class IHEADRequest(IRequest): - """ Request type interface attached to HEAD requests""" +class IRouteRequest(IRequest): + """ *internal only* interface used to mark a request when a route + matches. Not an API.""" class IResponseFactory(Interface): """ A utility which generates a response factory """ @@ -36,7 +25,25 @@ class IResponse(Interface): class IView(Interface): def __call__(context, request): - """ Must return an object that implements IResponse """ + """ Must return an object that implements IResponse. May + optionally raise ``repoze.bfg.security.Unauthorized`` if an + authorization failure is detected during view execution.""" + +class ISecuredView(IView): + """ Internal interface. Not an API. """ + def __call_permissive__(context, request): + """ Guaranteed-permissive version of __call__ """ + + def __permitted__(context, request): + """ Return True if view execution will be permitted using the + context and request, False otherwise""" + +class IMultiView(ISecuredView): + """ *internal only*. A multiview is a secured view that is a + collection of other views. Each of the views is associated with + zero or more predicates. Not an API.""" + def add(view, predicates, score): + """ Add a view to the multiview. """ class IRootFactory(Interface): def __call__(environ): @@ -227,10 +234,6 @@ class IAuthorizationPolicy(Interface): def principals_allowed_by_permission(context, permission): """ Return a set of principal identifiers allowed by the permission """ -class IRequestFactories(Interface): - """ Marker utility interface representing a dictionary of request - factory descriptions""" - class IPackageOverrides(Interface): """ Utility for pkg_resources overrides """ -- cgit v1.2.3