Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

git-svn-id: svn://cherokee-project.com/cherokee-pyscgi@517 5dc97367-9…

…7f1-0310-9951-d761b3857238
  • Loading branch information...
commit ef95578db4100235b34a54a10466bbf375e7609b 1 parent 2d94078
Alvaro Lopez Ortega alobbs authored
11 ChangeLog
View
@@ -1,3 +1,14 @@
+2006-12-12 Alvaro Lopez Ortega <alvaro@alobbs.com>
+
+ * tests/test1_env.py, tests/test2_post.py: Updated for using
+ ServerFactory.
+
+ * pyscgi/pyscgi.py: Added new SCGIServerFork class implementing a
+ forking server. So far I had only a Thread based one.
+
+ * pyscgi/pyscgi.py (ServerFactory): Added a new factory function
+ to instance servers.
+
2006-12-10 Alvaro Lopez Ortega <alvaro@alobbs.com>
* pyscgi/pyscgi.py, tests/test1_env.py, tests/test2_post.py: First
14 pyscgi/pyscgi.py
View
@@ -103,4 +103,16 @@ def handle_request (self):
class SCGIServer(SocketServer.ThreadingTCPServer):
def __init__(self, handler_class=SCGIHandler, host="", port=4000):
self.allow_reuse_address = True
- SocketServer.TCPServer.__init__ (self, (host, port), handler_class)
+ SocketServer.ThreadingTCPServer.__init__ (self, (host, port), handler_class)
+
+class SCGIServerFork (SocketServer.ForkingTCPServer):
+ def __init__(self, handler_class=SCGIHandler, host="", port=4000):
+ self.allow_reuse_address = True
+ SocketServer.ForkingTCPServer.__init__ (self, (host, port), handler_class)
+
+
+def ServerFactory (threading=False, *args, **kargs):
+ if threading:
+ return SCGIServer(*args, **kargs)
+ else:
+ return SCGIServerFork(*args, **kargs)
4 tests/test1_env.py
View
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-from pyscgi import SCGIHandler, SCGIServer
+from pyscgi import ServerFactory, SCGIHandler
DEFAULT_PORT = 4000
@@ -20,7 +20,7 @@ def handle_request (self):
self.print_env()
def main():
- srv = SCGIServer(handler_class=MyHandler, port=DEFAULT_PORT)
+ srv = ServerFactory(handler_class=MyHandler, port=DEFAULT_PORT)
srv.serve_forever()
if __name__ == "__main__":
4 tests/test2_post.py
View
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-from pyscgi import SCGIHandler, SCGIServer
+from pyscgi import SCGIHandler, ServerFactory
DEFAULT_PORT = 4000
POST_EXAMPLE = """
@@ -36,7 +36,7 @@ def handle_request (self):
self.output.write(POST_EXAMPLE)
def main():
- srv = SCGIServer(handler_class=MyHandler, port=DEFAULT_PORT)
+ srv = ServerFactory(handler_class=MyHandler, port=DEFAULT_PORT)
srv.serve_forever()
if __name__ == "__main__":
Please sign in to comment.
Something went wrong with that request. Please try again.