You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by Ron Henderson <rh...@anim.dreamworks.com> on 2004/02/14 03:12:46 UTC

Possible bug in apache.py for mod_python-3.0.4?

I found what looks like a small bug in lib/mod_python/apache.py:

def restore_nocgi(sav_env, si, so):
     """ see setup_cgi() """

     osenv = os.environ

     # restore env
     for k in osenv.keys():
         del osenv[k]
     for k in sav_env:
         osenv[k] = env[k]

     sys.stdout = si
     sys.stdin = so


On line 766 the statement "osenv[k] = env[k]" generates an error because env is 
undefined.  I think the correct verison of this function is:

def restore_nocgi(sav_env, si, so):
     """ see setup_cgi() """

     osenv = os.environ

     # restore env
     for k in osenv.keys():
         del osenv[k]
     for k in sav_env.keys():
         osenv[k] = sav_env[k]

     sys.stdout = si
     sys.stdin = so