File: fastcgi_server.py

package info (click to toggle)
quixote 2.4-5.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,016 kB
  • ctags: 1,078
  • sloc: python: 5,707; ansic: 1,418; makefile: 86; sh: 78
file content (26 lines) | stat: -rwxr-xr-x 789 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python
"""$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/quixote/server/fastcgi_server.py $
$Id: fastcgi_server.py 27684 2005-11-10 15:25:17Z dbinger $

Server for Quixote applications that use FastCGI.  It should work
for CGI too but the cgi_server module is preferred as it is more
portable.
"""

from quixote.server import _fcgi

def run(create_publisher):
    publisher = create_publisher()
    while _fcgi.isFCGI():
        f = _fcgi.FCGI()
        response = publisher.process(f.inp, f.env)
        try:
            response.write(f.out)
        except IOError, err:
            publisher.log("IOError while sending response ignored: %s" % err)
        f.Finish()


if __name__ == '__main__':
    from quixote.demo import create_publisher
    run(create_publisher)