The following apache demo setup and changes to the existing mod_python_handler.py script appears to work with quixote 2.0a3 and mod_python (2.7.10 for apache 1.3). The mod_python_handler.py should remain backwards compatible with quixote 1. As I consider myself a neophyte with mod_python and quixote, feel free to improve upon it. FWIW, ClintSetHandler python-program PythonHandler quixote.mod_python_handler PythonOption quixote-publisher-factory quixote.demo.create_publisher PythonInterpreter quixote.demo PythonDebug On diff -u mod_python_handler.py new_mod_python_handler.py --- mod_python_handler.py Sun Jan 16 21:45:15 2005 +++ new_mod_python_handler.py Sun Jan 16 21:44:52 2005 @@ -8,7 +8,7 @@ import sys from mod_python import apache -from quixote import enable_ptl +from quixote import enable_ptl, __version__ from quixote.publish import Publisher from quixote.config import Config @@ -54,12 +54,34 @@ finally: self.__apache_request = None -enable_ptl() - name2publisher = {} +def run(publisher, req): + from quixote.http_request import HTTPRequest + request = HTTPRequest(apache.CGIStdin(req), apache.build_cgi_env(req)) + response = publisher.process_request(request) + try: + response.write(apache.CGIStdout(req)) + except IOError, err: + publisher.log("IOError while sending response ignored: %s" % err) + return apache.OK + def handler(req): opts = req.get_options() + if int(__version__[0]) > 1: + try: + factory = opts['quixote-publisher-factory'] + except KeyError: + apache.log_error('quixote-publisher-factory setting required') + return apache.HTTP_INTERNAL_SERVER_ERROR + pub = name2publisher.get(factory) + if pub is None: + from quixote.util import import_object + factory_fcn = import_object(factory) + pub = factory_fcn() + name2publisher[factory] = pub + return run(pub, req) + try: package = opts['quixote-root-namespace'] except KeyError: @@ -77,6 +99,7 @@ pub = name2publisher.get(package) if pub is None: + enable_ptl() pub = ModPythonPublisher(package, config=config) name2publisher[package] = pub return pub.publish_modpython(req)