/usr/share/pyshared/quixote/wsgi.py is in python-quixote 2.7~b2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | """
QWIP: a simple yet functional Quixote/WSGI application-side adapter for
Quixote 2.x.
To create an application object, execute
app_obj = QWIP(publisher)
Authors: Mike Orr <mso@oz.net> and Titus Brown <titus@caltech.edu>.
Last updated 2005-05-03.
"""
import sys
from http_request import HTTPRequest
from StringIO import StringIO
###### QWIP: WSGI COMPATIBILITY WRAPPER FOR QUIXOTE #####################
class QWIP:
"""I make a Quixote Publisher object look like a WSGI application."""
request_class = HTTPRequest
def __init__(self, publisher):
self.publisher = publisher
def __call__(self, env, start_response):
"""I am called for each request."""
if env.get('wsgi.multithread') and not \
getattr(self.publisher, 'is_thread_safe', False):
reason = "%r is not thread safe" % self.publisher
raise AssertionError(reason)
if 'REQUEST_URI' not in env:
env['REQUEST_URI'] = env['SCRIPT_NAME'] + env['PATH_INFO']
input = env['wsgi.input']
request = self.request_class(input, env)
response = self.publisher.process_request(request)
status = "%03d %s" % (response.status_code, response.reason_phrase)
headers = response.generate_headers()
start_response(status, headers)
return response.generate_body_chunks() # Iterable object.
|