Back to index

moin  1.9.0~rc2
Classes | Functions | Variables
MoinMoin.support.flup.server.fcgi_fork Namespace Reference

Classes

class  WSGIServer

Functions

def test_app

Variables

string __author__ = 'Allan Saddi <allan@saddi.com>'
string __version__ = '$Revision$'
list __all__ = ['WSGIServer']
tuple test_app = validate.validator(test_app)

Detailed Description

.. highlight:: python
   :linenothreshold: 5

.. highlight:: bash
   :linenothreshold: 5

fcgi - a FastCGI/WSGI gateway.

:copyright: Copyright (c) 2005, 2006 Allan Saddi <allan@saddi.com>
  All rights reserved.
:license:

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
 are met:

 1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
 2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.

 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS **AS IS** AND
 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 SUCH DAMAGE.

For more information about FastCGI, see http://www.fastcgi.com/.

For more information about the Web Server Gateway Interface, see
http://www.python.org/peps/pep-0333.html.

Example usage::

  #!/usr/bin/env python
  from myapplication import app # Assume app is your WSGI application object
  from fcgi import WSGIServer
  WSGIServer(app).run()

See the documentation for WSGIServer for more information.

On most platforms, fcgi will fallback to regular CGI behavior if run in a
non-FastCGI context. If you want to force CGI behavior, set the environment
variable FCGI_FORCE_CGI to "Y" or "y".

Function Documentation

def MoinMoin.support.flup.server.fcgi_fork.test_app (   environ,
  start_response 
)
Probably not the most efficient example.

Definition at line 146 of file fcgi_fork.py.

00146 
00147     def test_app(environ, start_response):
00148         """Probably not the most efficient example."""
00149         import cgi
00150         start_response('200 OK', [('Content-Type', 'text/html')])
00151         yield '<html><head><title>Hello World!</title></head>\n' \
00152               '<body>\n' \
00153               '<p>Hello World!</p>\n' \
00154               '<table border="1">'
00155         names = environ.keys()
00156         names.sort()
00157         for name in names:
00158             yield '<tr><td>%s</td><td>%s</td></tr>\n' % (
00159                 name, cgi.escape(`environ[name]`))
00160 
00161         form = cgi.FieldStorage(fp=environ['wsgi.input'], environ=environ,
00162                                 keep_blank_values=1)
00163         if form.list:
00164             yield '<tr><th colspan="2">Form data</th></tr>'
00165 
00166         for field in form.list:
00167             yield '<tr><td>%s</td><td>%s</td></tr>\n' % (
00168                 field.name, field.value)
00169 
00170         yield '</table>\n' \
00171               '</body></html>\n'


Variable Documentation

Definition at line 64 of file fcgi_fork.py.

string MoinMoin.support.flup.server.fcgi_fork.__author__ = 'Allan Saddi <allan@saddi.com>'

Definition at line 55 of file fcgi_fork.py.

Definition at line 56 of file fcgi_fork.py.

Definition at line 173 of file fcgi_fork.py.