durusmail: quixote-users: where do mod_python print statements go?
where do mod_python print statements go?
2001-10-12
2001-10-12
2001-10-12
2001-10-12
2001-10-12
2001-10-12
2001-10-15
2001-10-15
2001-10-15
2001-10-15
2001-10-15
2001-10-15
2001-10-15
where do mod_python print statements go?
Ray Drew
2001-10-15
> -----Original Message-----
> From: Greg Ward [mailto:gward@mems-exchange.org]
> Sent: 15 October 2001 14:26
[...]
> Ahh yes, that would be it.  Since CGI driver scripts are
> responsible for
> calling setup_logs(), the mod_python handler has to do so as well.
>
> --- mod_python_handler.py       2001/09/28 21:03:22     1.5
> +++ mod_python_handler.py       2001/10/15 13:24:42
> @@ -44,4 +44,7 @@
>      else:
> -        if not name2publisher.has_key(package):
> -            name2publisher[package] = ModPythonPublisher(package)
> -        return name2publisher[package].publish_modpython(req)
> +        pub = name2publisher.get(package)
> +        if pub is None:
> +            pub = ModPythonPublisher(package)
> +            pub.setup_logs()
> +            name2publisher[package] = pub
> +        return pub.publish_modpython(req)

the other thing that the cgi driver script does that mod_python_handler.py
also needs to do is optionally read a configuration file..

demo.cgi has the line:-

# (Optional step) Read a configuration file
app.read_config("demo.conf")

Unless I've missed something, I think this also needs to be added for the
mod_python handler.

If you add a line in the httpd.conf section something like...

PythonOption config-file
d:\\\\bin\\\\python21\\\\quixote\\\\demo\\\\demo.conf

and amend mod_python_handler.handler() to something like..

def handler(req):
    opts = req.get_options()

    try:
        package = opts['quixote-root-namespace']
    except KeyError:
        package = None
+    try:
+       config_file = opts['config-file']
+    except KeyError:
+       config_file = None

    if not package:
        return apache.HTTP_INTERNAL_SERVER_ERROR
    else:
        pub = name2publisher.get(package)
        if pub is None:
            pub = ModPythonPublisher(package)
+           if config_file:
+               pub.read_config(config_file)
            pub.setup_logs()
            name2publisher[package] = pub
        return pub.publish_modpython(req)

You might want to check config_file for more than not None.

Ray Drew
CONFIDENTIALITY - The information in this e-mail and any attachment is
confidential and is intended only for the named recipient(s).  The E-mail
may not be disclosed or used by any person other than the addressee, nor may
it be copied in any way.  If you are not a named recipient please notify the
sender immediately and delete any copies of this message.


reply