summaryrefslogtreecommitdiff
path: root/wsgitools
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2009-02-01 00:39:12 +0100
committerHelmut Grohne <helmut@subdivi.de>2009-02-01 00:39:12 +0100
commite1f743fa71cf889cf2020f91bcfa4f491d3d3983 (patch)
tree216372e4fafa42ef30fabdaa5585bb1d886632e2 /wsgitools
parent73f9e704c5dec4e44bffad75016710542930731b (diff)
downloadwsgitools-e1f743fa71cf889cf2020f91bcfa4f491d3d3983.tar.gz
added config parameter (for environ) to scgi.forkpool
Diffstat (limited to 'wsgitools')
-rw-r--r--wsgitools/scgi/forkpool.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/wsgitools/scgi/forkpool.py b/wsgitools/scgi/forkpool.py
index 0393bb1..90c836a 100644
--- a/wsgitools/scgi/forkpool.py
+++ b/wsgitools/scgi/forkpool.py
@@ -167,7 +167,7 @@ class SCGIServer:
self.state = state
def __init__(self, wsgiapp, port, interface="localhost", error=sys.stderr,
- minworkers=2, maxworkers=32, maxrequests=1000):
+ minworkers=2, maxworkers=32, maxrequests=1000, config={}):
"""
@param wsgiapp: is the WSGI application to be run.
@type port: int
@@ -184,6 +184,9 @@ class SCGIServer:
@type maxrequests: int
@param maxrequests: is the number of requests a worker processes before
dying
+ @type config: {}
+ @param config: the environ dictionary is updated using these values for
+ each request.
"""
assert hasattr(error, "write")
self.wsgiapp = wsgiapp
@@ -192,6 +195,7 @@ class SCGIServer:
self.minworkers = minworkers
self.maxworkers = maxworkers
self.maxrequests = maxrequests
+ self.config = config
self.error = error
self.server = None # becomes a socket
# maps filedescriptors to WorkerStates
@@ -316,7 +320,7 @@ class SCGIServer:
con.close()
return
- environ = {}
+ environ = self.config.copy()
while data:
key = data.pop(0)
value = data.pop(0)