SF # 555779, import user doesn't work with CGIs

This commit is contained in:
Neal Norwitz 2002-09-05 21:08:25 +00:00
parent bd9adab138
commit 609ba81cdb
2 changed files with 6 additions and 2 deletions

View File

@ -303,8 +303,10 @@ def expanduser(path):
i = i + 1
if i == 1:
if not 'HOME' in os.environ:
return path
userhome = os.environ['HOME']
import pwd
userhome = pwd.getpwuid(os.getuid())[5]
else:
userhome = os.environ['HOME']
else:
import pwd
try:

View File

@ -26,6 +26,8 @@ import os
home = os.curdir # Default
if 'HOME' in os.environ:
home = os.environ['HOME']
elif os.name == 'posix':
home = os.path.expanduser("~/")
elif os.name == 'nt': # Contributed by Jeff Bauer
if 'HOMEPATH' in os.environ:
if 'HOMEDRIVE' in os.environ: