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/interfaces.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'repoze/bfg/interfaces.py') diff --git a/repoze/bfg/interfaces.py b/repoze/bfg/interfaces.py index 92e906e51..013267b7f 100644 --- a/repoze/bfg/interfaces.py +++ b/repoze/bfg/interfaces.py @@ -28,6 +28,13 @@ deprecated( IRootPolicy = "repoze.bfg.interfaces:IRootFactory", ) +class IRequestFactory(Interface): + """ A utility which generates a request factory """ + def __call__(self): + """ Return a request factory (e.g. a callable that accepts an + environ and returns an object implementing IRequest, + e.g. ``webob.Request``)""" + class IRequest(Interface): """ Request type interface attached to all request objects """ @@ -46,6 +53,14 @@ class IDELETERequest(IRequest): class IHEADRequest(IRequest): """ Request type interface attached to HEAD requests""" +class IResponseFactory(Interface): + """ A utility which generates a response factory """ + def __call__(self): + """ Return a response factory (e.g. a callable that returns an + object implementing IResponse, e.g. ``webob.Response``; it + should accept all the arguments that the webob.Response class + accepts)""" + class IResponse(Interface): status = Attribute('WSGI status code of response') headerlist = Attribute('List of response headers') -- cgit v1.2.3