diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-01-15 00:20:04 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-01-15 00:20:04 +0000 |
| commit | c8cf2256655ee4b34ec501325b9016608b5cce5f (patch) | |
| tree | 065c104d852d70389ce328813e2e8ea33e9885ce /repoze/bfg/interfaces.py | |
| parent | ec54985a5c27846a7e9444c22bcf46ae7e868b66 (diff) | |
| download | pyramid-c8cf2256655ee4b34ec501325b9016608b5cce5f.tar.gz pyramid-c8cf2256655ee4b34ec501325b9016608b5cce5f.tar.bz2 pyramid-c8cf2256655ee4b34ec501325b9016608b5cce5f.zip | |
- 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.
Diffstat (limited to 'repoze/bfg/interfaces.py')
| -rw-r--r-- | repoze/bfg/interfaces.py | 15 |
1 files changed, 15 insertions, 0 deletions
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') |
