[mod_python] Getting mod_python version

Gustavo Córdova Avila gustavo.cordova at q-voz.com
Tue Dec 2 12:47:27 EST 2003


This is the correct, "pythonic" way of doing things.

I'd recommend using "except AttributeError:" instead of a naked 
"except:" btw.

-gustavo

Michael C. Neel wrote:

>Hi all,
>
>	I don't know if it's not there, or I'm just overlooking it, but
>I can seem for a way in code to get the version of mod_python.  I have
>some "default" modules I use, and I am trying to make them work with any
>mod_python version.  Right now I'm doing try block, like such:
>
>    # Get username/password from client
>    pw = req.get_basic_auth_pw()
>    try:
>        # mod_python 2.x
>        user = req.connection.user
>    except:
>        # mod_python 3.x
>        user = req.user
>
>	...but I'd rather be able to get the version directly.
>
>Mike
>
>_______________________________________________
>Mod_python mailing list
>Mod_python at modpython.org
>http://mailman.modpython.org/mailman/listinfo/mod_python
>
>
>  
>



More information about the Mod_python mailing list