|
Nicolas Lehuen
nicolas.lehuen at gmail.com
Thu May 19 02:24:41 EDT 2005
Depending on your configuration, the mod_python version number appears
in your server identification string (this is configured by the
ServerTokens directive in httpd.conf).
You can then get mod_python's version number by parsing the
SERVER_SOFTWARE environment variable obtained by :
req.add_common_vars()
req.subprocess_env.get('SERVER_SOFTWARE')
Have a look at the upcoming testhandler which output a bunch of
diagnostic information :
http://svn.apache.org/repos/asf/httpd/mod_python/trunk/lib/python/mod_python/testhandler.py
Regards,
Nicolas
2005/5/19, Graham Dumpleton <grahamd at dscpl.com.au>:
> dharana wrote ..
> > Is it possible to get the version mod_python is currently running?
> >
> > (Background: an script that checks all necessary packages are available
> > and that they are at least x.y.z version)
>
> I may be missing the obvious, but don't recollect ever seeing a
> version tag and couldn't find when I looked again just then.
>
> Is this script mean't to be able to run on a command line or is
> executing under mod_python itself?
>
> The problem with trying to run a standalone script to determine
> something about mod_python is that mod_python will not fully
> load if not imported from within the context of an interpretor
> running under Apache. The best I have managed to come up with
> as a guide to determining which version of mod_python is to
> try and import the psp module and see what sort of import error
> occurs. See the description in:
>
> http://www.dscpl.com.au/projects/vampire/articles/modpython-001.html#version-number
>
> >From code running under mod_python itself, there are a few
> subtle differences in member data present in the request object
> which one can used to determine between 2.7 and 3.1. For
> example:
>
> if hasattr(req,"hlist"):
> # In mod_python 3.X have the req.hlist member.
> handler_root = req.hlist.directory
>
> elif hasattr(req,"get_dirs"):
> # In mod_python 2.X have the req.get_dirs() method.
> handler_root = req.get_dirs()["PythonHandler"]
>
> Don't know if this helps or not.
>
> Graham
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
|