Changeset 517

Show
Ignore:
Timestamp:
12/12/06 10:44:58 (2 years ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee-pyscgi/ChangeLog

    r504 r517  
     12006-12-12  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * tests/test1_env.py, tests/test2_post.py: Updated for using 
     4        ServerFactory. 
     5 
     6        * pyscgi/pyscgi.py: Added new SCGIServerFork class implementing a 
     7        forking server. So far I had only a Thread based one. 
     8 
     9        * pyscgi/pyscgi.py (ServerFactory): Added a new factory function 
     10        to instance servers. 
     11 
    1122006-12-10  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
    213 
  • cherokee-pyscgi/pyscgi/pyscgi.py

    r504 r517  
    104104    def __init__(self, handler_class=SCGIHandler, host="", port=4000): 
    105105        self.allow_reuse_address = True 
    106         SocketServer.TCPServer.__init__ (self, (host, port), handler_class) 
     106        SocketServer.ThreadingTCPServer.__init__ (self, (host, port), handler_class) 
     107 
     108class SCGIServerFork (SocketServer.ForkingTCPServer): 
     109    def __init__(self, handler_class=SCGIHandler, host="", port=4000): 
     110        self.allow_reuse_address = True 
     111        SocketServer.ForkingTCPServer.__init__ (self, (host, port), handler_class) 
     112 
     113 
     114def ServerFactory (threading=False, *args, **kargs): 
     115    if threading: 
     116        return SCGIServer(*args, **kargs) 
     117    else: 
     118        return SCGIServerFork(*args, **kargs) 
  • cherokee-pyscgi/tests/test1_env.py

    r504 r517  
    11#!/usr/bin/env python 
    22 
    3 from pyscgi import SCGIHandler, SCGIServer 
     3from pyscgi import ServerFactory, SCGIHandler 
    44 
    55DEFAULT_PORT = 4000 
     
    2121 
    2222def main(): 
    23     srv = SCGIServer(handler_class=MyHandler, port=DEFAULT_PORT) 
     23    srv = ServerFactory(handler_class=MyHandler, port=DEFAULT_PORT) 
    2424    srv.serve_forever() 
    2525 
  • cherokee-pyscgi/tests/test2_post.py

    r504 r517  
    11#!/usr/bin/env python 
    22 
    3 from pyscgi import SCGIHandler, SCGIServer 
     3from pyscgi import SCGIHandler, ServerFactory 
    44 
    55DEFAULT_PORT = 4000 
     
    3737 
    3838def main(): 
    39     srv = SCGIServer(handler_class=MyHandler, port=DEFAULT_PORT) 
     39    srv = ServerFactory(handler_class=MyHandler, port=DEFAULT_PORT) 
    4040    srv.serve_forever() 
    4141