[mod_python] req.connection.user generates AttributeError

Hancock, David (DHANCOCK) DHANCOCK at arinc.com
Mon Oct 20 08:21:33 EST 2003

Thanks Glenn and Grisha.

To recap:

1. Putting the assignment from req.user AFTER the req.get_basic_auth_pw call
fixes the AttributeError, and the LoadModule for mod_python can now be
anywhere in the list of Apache modules.

2. req.user can indeed be assigned to--smart stuff.

David Hancock | dhancock at arinc.com | 410-266-4384

-----Original Message-----
From: Glenn A. Hochberg [mailto:gah at research.att.com] 
Sent: Sunday, October 19, 2003 10:24 PM
Subject: Re: [mod_python] req.connection.user generates AttributeError

> I'm new to mod_python, and I'm stuck already.  I'm working through the
> examples in the documentation, and even after careful typing (and cutting
> and pasting from the manual), I can't get the authentication example to
> work.  The line:
> 	user = req.connection.user
> Gives an attribute error ('user').  As shown in the manual, I'm calling
> req.get_basic_auth_pw() first, but still no joy.

I ran into this too.  The documentation is wrong; you should use req.user
instead.  Also note that you *can* assign a value to req.user -- it's not
read-only as listed in the docs.

-Glenn Hochberg

Mod_python mailing list
Mod_python at modpython.org

More information about the Mod_python mailing list