summaryrefslogtreecommitdiff
path: root/repoze/bfg/wsgi.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-01-15 00:20:04 +0000
committerChris McDonough <chrism@agendaless.com>2009-01-15 00:20:04 +0000
commitc8cf2256655ee4b34ec501325b9016608b5cce5f (patch)
tree065c104d852d70389ce328813e2e8ea33e9885ce /repoze/bfg/wsgi.py
parentec54985a5c27846a7e9444c22bcf46ae7e868b66 (diff)
downloadpyramid-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/wsgi.py')
-rw-r--r--repoze/bfg/wsgi.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/repoze/bfg/wsgi.py b/repoze/bfg/wsgi.py
index 149273c27..93b2c143b 100644
--- a/repoze/bfg/wsgi.py
+++ b/repoze/bfg/wsgi.py
@@ -1,3 +1,7 @@
+from zope.component import queryUtility
+
+from repoze.bfg.interfaces import IResponseFactory
+
from webob import Response
try:
from functools import wraps
@@ -37,7 +41,8 @@ def wsgiapp(wrapped):
body = wrapped(environ, catch_start_response)
if caught:
status, headers, exc_info = caught
- response = Response()
+ response_factory = queryUtility(IResponseFactory, default=Response)
+ response = response_factory()
response.app_iter = body
response.status = status
response.headerlist = headers