summaryrefslogtreecommitdiff
path: root/repoze/bfg/wsgiadapter.py
diff options
context:
space:
mode:
Diffstat (limited to 'repoze/bfg/wsgiadapter.py')
-rw-r--r--repoze/bfg/wsgiadapter.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/repoze/bfg/wsgiadapter.py b/repoze/bfg/wsgiadapter.py
index 16effe1a5..9b35c6aa2 100644
--- a/repoze/bfg/wsgiadapter.py
+++ b/repoze/bfg/wsgiadapter.py
@@ -15,6 +15,13 @@ class IViewSecurityPolicy(Interface):
otherwise it should return a WSGI application representing an
unauthorized view"""
+def isResponse(ob):
+ if ( hasattr(ob, 'app_iter') and hasattr(ob, 'headerlist') and
+ hasattr(ob, 'status') ):
+ if ( hasattr(ob.app_iter, '__iter__') and
+ hasattr(ob.headerlist, '__iter__') ):
+ return True
+
class NaiveWSGIViewAdapter:
classProvides(IWSGIApplicationFactory)
implements(IWSGIApplication)
@@ -44,7 +51,10 @@ class NaiveWSGIViewAdapter:
'start_response':start_response,
}
- response = mapply(view, positional = (), keyword = kwdict)
+ if isResponse(view):
+ response = view
+ else:
+ response = mapply(view, positional = (), keyword = kwdict)
if not catch_response:
catch_response = (response.status, response.headerlist)
start_response(*catch_response)