changeset 107:ddcbf3af11f1

Merged flup repo 93:c3894d7dd583
author Velko Ivanov <vivanov@ivanov-nest.com>
date Mon, 31 Oct 2011 14:45:14 +0200
parents b742134454a0 c3894d7dd583
children 50e45ce58629
files flup/server/ajp.py flup/server/ajp_base.py flup/server/ajp_fork.py flup/server/fcgi.py flup/server/fcgi_base.py flup/server/fcgi_fork.py flup/server/fcgi_single.py flup/server/scgi.py flup/server/scgi_base.py flup/server/scgi_fork.py
diffstat 12 files changed, 66 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/flup/server/__init__.py	Mon Oct 31 14:41:14 2011 +0200
     1.2 +++ b/flup/server/__init__.py	Mon Oct 31 14:45:14 2011 +0200
     1.3 @@ -1,1 +1,5 @@
     1.4  #
     1.5 +class NoDefault(object):
     1.6 +    pass
     1.7 +
     1.8 +__all__ = [ 'NoDefault', ]
     2.1 --- a/flup/server/ajp.py	Mon Oct 31 14:41:14 2011 +0200
     2.2 +++ b/flup/server/ajp.py	Mon Oct 31 14:45:14 2011 +0200
     2.3 @@ -103,7 +103,7 @@
     2.4      def __init__(self, application, scriptName='', environ=None,
     2.5                   multithreaded=True, multiprocess=False,
     2.6                   bindAddress=('localhost', 8009), allowedServers=None,
     2.7 -                 loggingLevel=logging.INFO, debug=True, **kw):
     2.8 +                 loggingLevel=logging.INFO, debug=False, **kw):
     2.9          """
    2.10          scriptName is the initial portion of the URL path that "belongs"
    2.11          to your application. It is used to determine PATH_INFO (which doesn't
     3.1 --- a/flup/server/ajp_base.py	Mon Oct 31 14:41:14 2011 +0200
     3.2 +++ b/flup/server/ajp_base.py	Mon Oct 31 14:45:14 2011 +0200
     3.3 @@ -41,11 +41,10 @@
     3.4  import _thread
     3.5  import threading
     3.6  
     3.7 +from flup.server import NoDefault
     3.8 +
     3.9  __all__ = ['BaseAJPServer']
    3.10  
    3.11 -class NoDefault(object):
    3.12 -    pass
    3.13 -
    3.14  # Packet header prefixes.
    3.15  SERVER_PREFIX = b'\x12\x34'
    3.16  CONTAINER_PREFIX = b'AB'
    3.17 @@ -753,7 +752,7 @@
    3.18      def __init__(self, application, scriptName='', environ=None,
    3.19                   multithreaded=True, multiprocess=False,
    3.20                   bindAddress=('localhost', 8009), allowedServers=NoDefault,
    3.21 -                 loggingLevel=logging.INFO, debug=True):
    3.22 +                 loggingLevel=logging.INFO, debug=False):
    3.23          """
    3.24          scriptName is the initial portion of the URL path that "belongs"
    3.25          to your application. It is used to determine PATH_INFO (which doesn't
     4.1 --- a/flup/server/ajp_fork.py	Mon Oct 31 14:41:14 2011 +0200
     4.2 +++ b/flup/server/ajp_fork.py	Mon Oct 31 14:45:14 2011 +0200
     4.3 @@ -102,7 +102,7 @@
     4.4      """
     4.5      def __init__(self, application, scriptName='', environ=None,
     4.6                   bindAddress=('localhost', 8009), allowedServers=None,
     4.7 -                 loggingLevel=logging.INFO, debug=True, **kw):
     4.8 +                 loggingLevel=logging.INFO, debug=False, **kw):
     4.9          """
    4.10          scriptName is the initial portion of the URL path that "belongs"
    4.11          to your application. It is used to determine PATH_INFO (which doesn't
     5.1 --- a/flup/server/fcgi.py	Mon Oct 31 14:41:14 2011 +0200
     5.2 +++ b/flup/server/fcgi.py	Mon Oct 31 14:45:14 2011 +0200
     5.3 @@ -64,7 +64,7 @@
     5.4      def __init__(self, application, environ=None,
     5.5                   multithreaded=True, multiprocess=False,
     5.6                   bindAddress=None, umask=None, multiplexed=False,
     5.7 -                 debug=True, roles=(FCGI_RESPONDER,), forceCGI=False, **kw):
     5.8 +                 debug=False, roles=(FCGI_RESPONDER,), forceCGI=False, **kw):
     5.9          """
    5.10          environ, if present, must be a dictionary-like object. Its
    5.11          contents will be copied into application's environ. Useful
     6.1 --- a/flup/server/fcgi_base.py	Mon Oct 31 14:41:14 2011 +0200
     6.2 +++ b/flup/server/fcgi_base.py	Mon Oct 31 14:45:14 2011 +0200
     6.3 @@ -904,7 +904,7 @@
     6.4      def __init__(self, application, environ=None,
     6.5                   multithreaded=True, multiprocess=False,
     6.6                   bindAddress=None, umask=None, multiplexed=False,
     6.7 -                 debug=True, roles=(FCGI_RESPONDER,),
     6.8 +                 debug=False, roles=(FCGI_RESPONDER,),
     6.9                   forceCGI=False):
    6.10          """
    6.11          bindAddress, if present, must either be a string or a 2-tuple. If
     7.1 --- a/flup/server/fcgi_fork.py	Mon Oct 31 14:41:14 2011 +0200
     7.2 +++ b/flup/server/fcgi_fork.py	Mon Oct 31 14:45:14 2011 +0200
     7.3 @@ -64,7 +64,7 @@
     7.4      """
     7.5      def __init__(self, application, environ=None,
     7.6                   bindAddress=None, umask=None, multiplexed=False,
     7.7 -                 debug=True, roles=(FCGI_RESPONDER,), forceCGI=False, **kw):
     7.8 +                 debug=False, roles=(FCGI_RESPONDER,), forceCGI=False, **kw):
     7.9          """
    7.10          environ, if present, must be a dictionary-like object. Its
    7.11          contents will be copied into application's environ. Useful
     8.1 --- a/flup/server/fcgi_single.py	Mon Oct 31 14:41:14 2011 +0200
     8.2 +++ b/flup/server/fcgi_single.py	Mon Oct 31 14:45:14 2011 +0200
     8.3 @@ -64,7 +64,7 @@
     8.4      """
     8.5      def __init__(self, application, environ=None,
     8.6                   bindAddress=None, umask=None, multiplexed=False,
     8.7 -                 debug=True, roles=(FCGI_RESPONDER,), forceCGI=False, **kw):
     8.8 +                 debug=False, roles=(FCGI_RESPONDER,), forceCGI=False, **kw):
     8.9          """
    8.10          environ, if present, must be a dictionary-like object. Its
    8.11          contents will be copied into application's environ. Useful
     9.1 --- a/flup/server/paste_factory.py	Mon Oct 31 14:41:14 2011 +0200
     9.2 +++ b/flup/server/paste_factory.py	Mon Oct 31 14:45:14 2011 +0200
     9.3 @@ -1,5 +1,8 @@
     9.4  # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
     9.5  # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
     9.6 +
     9.7 +from flup.server import NoDefault
     9.8 +
     9.9  def asbool(obj):
    9.10      if isinstance(obj, (str, unicode)):
    9.11          obj = obj.strip().lower()
    9.12 @@ -26,35 +29,43 @@
    9.13          return [obj]
    9.14  
    9.15  def run_ajp_thread(wsgi_app, global_conf,
    9.16 -                   scriptName='', host='localhost', port='8009',
    9.17 -                   allowedServers='127.0.0.1'):
    9.18 +                   scriptName=NoDefault, host='localhost', port='8009',
    9.19 +                   allowedServers='127.0.0.1', debug=NoDefault):
    9.20      import flup.server.ajp
    9.21      addr = (host, int(port))
    9.22 +    if debug is NoDefault:
    9.23 +        debug = global_conf.get('debug', False)
    9.24 +    debug = asbool(debug)
    9.25      s = flup.server.ajp.WSGIServer(
    9.26          wsgi_app,
    9.27          scriptName=scriptName,
    9.28          bindAddress=addr,
    9.29          allowedServers=aslist(allowedServers),
    9.30 +        debug=debug,
    9.31          )
    9.32      s.run()
    9.33 -    
    9.34 +
    9.35  def run_ajp_fork(wsgi_app, global_conf,
    9.36                   scriptName='', host='localhost', port='8009',
    9.37 -                 allowedServers='127.0.0.1'):
    9.38 +                 allowedServers='127.0.0.1', debug=NoDefault):
    9.39      import flup.server.ajp_fork
    9.40      addr = (host, int(port))
    9.41 +    if debug is NoDefault:
    9.42 +        debug = global_conf.get('debug', False)
    9.43 +    debug = asbool(debug)
    9.44      s = flup.server.ajp_fork.WSGIServer(
    9.45          wsgi_app,
    9.46          scriptName=scriptName,
    9.47          bindAddress=addr,
    9.48          allowedServers=aslist(allowedServers),
    9.49 +        debug=debug,
    9.50          )
    9.51      s.run()
    9.52  
    9.53  def run_fcgi_thread(wsgi_app, global_conf,
    9.54                      host=None, port=None,
    9.55                      socket=None, umask=None,
    9.56 -                    multiplexed=False):
    9.57 +                    multiplexed=False, debug=NoDefault):
    9.58      import flup.server.fcgi
    9.59      if socket:
    9.60          assert host is None and port is None
    9.61 @@ -66,16 +77,21 @@
    9.62          sock = None
    9.63      if umask is not None:
    9.64          umask = int(umask)
    9.65 +    if debug is NoDefault:
    9.66 +        debug = global_conf.get('debug', False)
    9.67 +    debug = asbool(debug)
    9.68      s = flup.server.fcgi.WSGIServer(
    9.69          wsgi_app,
    9.70          bindAddress=sock, umask=umask,
    9.71 -        multiplexed=asbool(multiplexed))
    9.72 +        multiplexed=asbool(multiplexed),
    9.73 +        debug=debug)
    9.74      s.run()
    9.75  
    9.76  def run_fcgi_fork(wsgi_app, global_conf,
    9.77                    host=None, port=None,
    9.78                    socket=None, umask=None,
    9.79 -                  multiplexed=False):
    9.80 +                  multiplexed=False,
    9.81 +                  debug=NoDefault):
    9.82      import flup.server.fcgi_fork
    9.83      if socket:
    9.84          assert host is None and port is None
    9.85 @@ -87,35 +103,49 @@
    9.86          sock = None
    9.87      if umask is not None:
    9.88          umask = int(umask)
    9.89 +    if debug is NoDefault:
    9.90 +        debug = global_conf.get('debug', False)
    9.91 +    debug = asbool(debug)
    9.92      s = flup.server.fcgi_fork.WSGIServer(
    9.93          wsgi_app,
    9.94          bindAddress=sock, umask=umask,
    9.95 -        multiplexed=asbool(multiplexed))
    9.96 +        multiplexed=asbool(multiplexed),
    9.97 +        debug=debug)
    9.98      s.run()
    9.99  
   9.100  def run_scgi_thread(wsgi_app, global_conf,
   9.101 -                    scriptName='', host='localhost', port='4000',
   9.102 -                    allowedServers='127.0.0.1'):
   9.103 +                    scriptName=NoDefault, host='localhost', port='4000',
   9.104 +                    allowedServers='127.0.0.1',
   9.105 +                    debug=NoDefault):
   9.106      import flup.server.scgi
   9.107      addr = (host, int(port))
   9.108 +    if debug is NoDefault:
   9.109 +        debug = global_conf.get('debug', False)
   9.110 +    debug = asbool(debug)
   9.111      s = flup.server.scgi.WSGIServer(
   9.112          wsgi_app,
   9.113          scriptName=scriptName,
   9.114          bindAddress=addr,
   9.115          allowedServers=aslist(allowedServers),
   9.116 +        debug=debug,
   9.117          )
   9.118      s.run()
   9.119  
   9.120  def run_scgi_fork(wsgi_app, global_conf,
   9.121 -                  scriptName='', host='localhost', port='4000',
   9.122 -                  allowedServers='127.0.0.1'):
   9.123 +                  scriptName=NoDefault, host='localhost', port='4000',
   9.124 +                  allowedServers='127.0.0.1',
   9.125 +                  debug=NoDefault):
   9.126      import flup.server.scgi_fork
   9.127      addr = (host, int(port))
   9.128 +    if debug is NoDefault:
   9.129 +        debug = global_conf.get('debug', False)
   9.130 +    debug = asbool(debug)
   9.131      s = flup.server.scgi_fork.WSGIServer(
   9.132          wsgi_app,
   9.133          scriptName=scriptName,
   9.134          bindAddress=addr,
   9.135          allowedServers=aslist(allowedServers),
   9.136 +        debug=debug,
   9.137          )
   9.138      s.run()
   9.139 -    
   9.140 +
    10.1 --- a/flup/server/scgi.py	Mon Oct 31 14:41:14 2011 +0200
    10.2 +++ b/flup/server/scgi.py	Mon Oct 31 14:45:14 2011 +0200
    10.3 @@ -66,8 +66,9 @@
    10.4  import logging
    10.5  import socket
    10.6  
    10.7 -from .scgi_base import BaseSCGIServer, Connection, NoDefault
    10.8 -from .threadedserver import ThreadedServer
    10.9 +from flup.server import NoDefault
   10.10 +from flup.server.scgi_base import BaseSCGIServer, Connection
   10.11 +from flup.server.threadedserver import ThreadedServer
   10.12  
   10.13  __all__ = ['WSGIServer']
   10.14  
   10.15 @@ -91,7 +92,7 @@
   10.16                   multithreaded=True, multiprocess=False,
   10.17                   bindAddress=('localhost', 4000), umask=None,
   10.18                   allowedServers=None,
   10.19 -                 loggingLevel=logging.INFO, debug=True, **kw):
   10.20 +                 loggingLevel=logging.INFO, debug=False, **kw):
   10.21          """
   10.22          scriptName is the initial portion of the URL path that "belongs"
   10.23          to your application. It is used to determine PATH_INFO (which doesn't
    11.1 --- a/flup/server/scgi_base.py	Mon Oct 31 14:41:14 2011 +0200
    11.2 +++ b/flup/server/scgi_base.py	Mon Oct 31 14:45:14 2011 +0200
    11.3 @@ -45,8 +45,7 @@
    11.4  
    11.5  __all__ = ['BaseSCGIServer']
    11.6  
    11.7 -class NoDefault(object):
    11.8 -    pass
    11.9 +from flup.server import NoDefault
   11.10  
   11.11  # The main classes use this name for logging.
   11.12  LoggerName = 'scgi-wsgi'
   11.13 @@ -278,7 +277,7 @@
   11.14                   multithreaded=True, multiprocess=False,
   11.15                   bindAddress=('localhost', 4000), umask=None,
   11.16                   allowedServers=NoDefault,
   11.17 -                 loggingLevel=logging.INFO, debug=True):
   11.18 +                 loggingLevel=logging.INFO, debug=False):
   11.19          """
   11.20          scriptName is the initial portion of the URL path that "belongs"
   11.21          to your application. It is used to determine PATH_INFO (which doesn't
    12.1 --- a/flup/server/scgi_fork.py	Mon Oct 31 14:41:14 2011 +0200
    12.2 +++ b/flup/server/scgi_fork.py	Mon Oct 31 14:45:14 2011 +0200
    12.3 @@ -66,8 +66,9 @@
    12.4  import logging
    12.5  import socket
    12.6  
    12.7 -from .scgi_base import BaseSCGIServer, Connection, NoDefault
    12.8 -from .preforkserver import PreforkServer
    12.9 +from flup.server import NoDefault
   12.10 +from flup.server.scgi_base import BaseSCGIServer, Connection
   12.11 +from flup.server.preforkserver import PreforkServer
   12.12  
   12.13  __all__ = ['WSGIServer']
   12.14  
   12.15 @@ -90,7 +91,7 @@
   12.16      def __init__(self, application, scriptName=NoDefault, environ=None,
   12.17                   bindAddress=('localhost', 4000), umask=None,
   12.18                   allowedServers=None,
   12.19 -                 loggingLevel=logging.INFO, debug=True, **kw):
   12.20 +                 loggingLevel=logging.INFO, debug=False, **kw):
   12.21          """
   12.22          scriptName is the initial portion of the URL path that "belongs"
   12.23          to your application. It is used to determine PATH_INFO (which doesn't