summaryrefslogtreecommitdiff
path: root/wsgitools/adapters.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2007-04-21 20:48:43 +0200
committerHelmut Grohne <helmut@subdivi.de>2007-04-21 20:48:43 +0200
commit5b5b4992ffdc3c3dc3b28c004f211288fb6affcf (patch)
tree8b2b1ac20aaea7d988ea7189cbf31d8617c66e61 /wsgitools/adapters.py
parent5835a547893a7e89ef19e1e4e0b270b78c814a28 (diff)
downloadwsgitools-5b5b4992ffdc3c3dc3b28c004f211288fb6affcf.tar.gz
added some assertions
Diffstat (limited to 'wsgitools/adapters.py')
-rw-r--r--wsgitools/adapters.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/wsgitools/adapters.py b/wsgitools/adapters.py
index 9f2ab1c..f575295 100644
--- a/wsgitools/adapters.py
+++ b/wsgitools/adapters.py
@@ -12,7 +12,11 @@ class WSGI2to1Adapter:
self.app = app
def __call__(self, environ, start_response):
"""WSGI 1.0 interface"""
+ assert isinstance(environ, dict)
status, headers, iterable = self.app(environ)
+ assert isinstance(status, str)
+ assert isinstance(headers, list)
+ assert hasattr(iterable, "__iter__")
start_response(status, headers)
return iterable
@@ -25,14 +29,18 @@ class WSGI1to2Adapter:
self.app = app
def __call__(self, environ):
"""some interface that might somewhen be known as WSGI 2.0"""
+ assert isinstance(environ, dict)
results = [None, None, []]
def start_response(status, headers, exc_info=None):
+ assert isinstance(status, str)
+ assert isinstance(headers, list)
results[0] = status
results[1] = headers
def write_callable(data):
results[2].append(data)
return write_callable
iterable = self.app(environ, start_response)
+ assert hasattr(iterable, "__iter__")
if isinstance(iterable, list):
# retaining .close attribute this way
iterable[:0] = results[2]