def handler(req): conf = req.get_config() # get module name to be published dir, file = os.path.split(req.filename) module_name, ext = os.path.splitext(file) # if autoreload is on, we will check dates # and reload the module if the source is newer apache.import_module(module_name, req) # setup CGI environment env, si, so = apache.setup_cgi(req) try: ZPublisher.publish_module(module_name, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, environ=os.environ) finally: apache.restore_nocgi(env, si, so) return apache.OK