Graham Dumpleton
graham.dumpleton at gmail.com
Tue Apr 17 18:45:29 EDT 2007
On 18/04/07, Prashanth <prashanth.dumpuri at vanderbilt.edu> wrote: > All, > > I'm trying to pick up REMOTE_USER from os.environ['REMOTE_USER'] and I > get a key error as shown below: > > ------------------------------------------------------------------------------------------------------------------------------------------------------------ > Mod_python error: "PythonHandler test" > Traceback (most recent call last): > File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, > in HandlerDispatch > result = object(req) > File "/var/www/modelweb/restricted/test.py", line 17, in handler > req.write(os.environ['REMOTE_USER']) > KeyError: 'REMOTE_USER' > > --------------------------------------------------------------------------------------------------------------------------------------------------------------- > Using cgi.print_environ() returns nothing. I'm using apache 2 (and > htpasswd), so I know REMOTE USER must be set. > > Here's my directory structure: > > index.html in /var/www/modelweb - that challenges the user with a login > prompt > test.py in /var/www/modelweb/restricted - that executes (or it's > supposed to) if the user's login is successful. > > Can someone help me figure out what's going on here ? Any help in this > regard will be greatly appreciated. If you are using AuthType directive then user is available as: req.user Note that mod_python is not CGI, so don't apply CGI concepts to it. You will not find CGI environment stuff in os.environ. Graham
|