summaryrefslogtreecommitdiff
path: root/paste/util
diff options
context:
space:
mode:
authorpjenvey <devnull@localhost>2006-06-17 22:30:59 +0000
committerpjenvey <devnull@localhost>2006-06-17 22:30:59 +0000
commitca0ae76479356887ddfaff87e7e12fbc268e55fc (patch)
tree9e9c494d8d3b96c5442de4e894d3bb57268c455c /paste/util
parent0c3ace1b22284c57ddfb8afb063d84c934d2770f (diff)
downloadpaste-ca0ae76479356887ddfaff87e7e12fbc268e55fc.tar.gz
added optional host and max_children args to scgi's serve_application.
Ideally the function prototype would match SCGIServers, i.e.: def serve_application(application, prefix, host=, port=None, max_children=None): or: def serve_application(application, prefix, **kwargs): (host, port and max_children could then default to SCGIServer's defaults), but that could break compatibility with those not explicitly using keyword args suggested by: greg@electricrain.com resolves: #55
Diffstat (limited to 'paste/util')
-rw-r--r--paste/util/scgiserver.py30
1 files changed, 28 insertions, 2 deletions
diff --git a/paste/util/scgiserver.py b/paste/util/scgiserver.py
index 7113330..2237795 100644
--- a/paste/util/scgiserver.py
+++ b/paste/util/scgiserver.py
@@ -137,11 +137,37 @@ class SWAP(scgi_server.SCGIHandler):
debug("IOError while closing connection ignored: %s" % err)
-def serve_application (application, prefix, port):
+def serve_application(application, prefix, port=None, host=None, max_children=None):
+ """
+ Serve the specified WSGI application via SCGI proxy.
+
+ ``application``
+ The WSGI application to serve.
+
+ ``prefix``
+ The prefix for what is served by the SCGI Web-server-side process.
+
+ ``port``
+ Optional port to bind the SCGI proxy to. Defaults to SCGIServer's
+ default port value.
+
+ ``host``
+ Optional host to bind the SCGI proxy to. Defaults to SCGIServer's
+ default host value.
+
+ ``host``
+ Optional maximum number of child processes the SCGIServer will
+ spawn. Defaults to SCGIServer's default max_children value.
+ """
class SCGIAppHandler(SWAP):
def __init__ (self, *args, **kwargs):
self.prefix = prefix
self.app_obj = application
SWAP.__init__(self, *args, **kwargs)
- scgi_server.SCGIServer(SCGIAppHandler, port=port).serve()
+ kwargs = dict(handler_class=SCGIAppHandler)
+ for kwarg in ('host', 'port', 'max_children'):
+ if locals()[kwarg] is not None:
+ kwargs[kwarg] = locals()[kwarg]
+
+ scgi_server.SCGIServer(**kwargs).serve()