[mod_python] Error in 3.1.2b documentation

John McCaskey jmccaskey1 at comcast.net
Thu Feb 5 21:33:57 EST 2004

Forgive me if this is a known issue and this documentation is just not up to
date as 3.1.2 is a beta version, however I am just getting familiar with
In section 3.4 the following example code is presented:
from mod_python import apache
def authenhandler(req):
    pw = req.get_basic_auth_pw()
    user = req.user
    if user == "spam" and pw == "eggs":
       return apache.OK
       return apache.HTTP_UNAUTHORIZED
This code would cause my apache to return a 500 internal server error and I
found the following in my logs:
[Thu Feb 05 21:24:09 2004] [error] [client] python_handler: After
PythonAuthenHandler req->user is NULL. Assign req.user to avoid this error.
>From that I was able to deduce the problem and added:
               req.user = 'unauthorized'
directly above the return apache.HTTP_UNAUTHORIZED.  
No big deal, but whoever takes care of the docs might want to update the
Btw, I love what I see so far! I'm a long time apache/php/mysql user and
I've also done several projects with j2ee and .net but I have high hopes
that mod_python will be a more flexible and powerful platform for some
upcoming projects!
John McCaskey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.modpython.org/pipermail/mod_python/attachments/20040205/98c05637/attachment-0001.html

More information about the Mod_python mailing list