From 5b5b4992ffdc3c3dc3b28c004f211288fb6affcf Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sat, 21 Apr 2007 20:48:43 +0200 Subject: added some assertions --- wsgitools/scgi/asynchronous.py | 2 ++ wsgitools/scgi/forkpool.py | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'wsgitools/scgi') diff --git a/wsgitools/scgi/asynchronous.py b/wsgitools/scgi/asynchronous.py index 9510b4d..ff226de 100644 --- a/wsgitools/scgi/asynchronous.py +++ b/wsgitools/scgi/asynchronous.py @@ -130,6 +130,8 @@ class SCGIConnection(asyncore.dispatcher): self.inbuff = "" def start_response(self, status, headers, exc_info=None): + assert isinstance(status, str) + assert isinstance(headers, list) if exc_info: if self.outheaders == True: try: diff --git a/wsgitools/scgi/forkpool.py b/wsgitools/scgi/forkpool.py index 1ff2bee..6476458 100644 --- a/wsgitools/scgi/forkpool.py +++ b/wsgitools/scgi/forkpool.py @@ -85,6 +85,7 @@ class SCGIServer: maxworkers is the maximum number of workers that can be spawned on demand maxrequests is the number of requests a worker processes before dying """ + assert hasattr(error, "write") self.wsgiapp = wsgiapp self.port = port self.interface = interface @@ -217,7 +218,10 @@ class SCGIServer: "wsgi.multithread": False, "wsgi.multiprocess": True, "wsgi.run_once": False}) + result = self.wsgiapp(environ, start_response) + assert hasattr(result, "__iter__") + for data in result: con.send(data) if hasattr(result, "close"): -- cgit v1.2.3