7258: Replace some os.environ['foo'] lookups missed earlier.

(cherry picked from commit 71650917bf)
This commit is contained in:
John Ralls 2014-03-27 11:32:37 -07:00
parent 50f514ce51
commit 15d1d0e6d0
3 changed files with 8 additions and 9 deletions

View File

@ -93,7 +93,7 @@ if 'GRAMPSHOME' in os.environ:
elif 'USERPROFILE' in os.environ:
USER_HOME = get_env_var('USERPROFILE')
if 'APPDATA' in os.environ:
HOME_DIR = os.path.join(os.environ['APPDATA'], 'gramps')
HOME_DIR = os.path.join(get_env_var('APPDATA'), 'gramps')
else:
HOME_DIR = os.path.join(USER_HOME, 'gramps')
else:

View File

@ -2266,10 +2266,9 @@ def write_lock_file(name):
os.mkdir(name)
f = open(os.path.join(name, DBLOCKFN), "w")
if win():
user = os.environ['USERNAME']
try:
host = os.environ['USERDOMAIN']
except:
user = get_env_var('USERNAME')
host = get_env_var('USERDOMAIN')
if host == None:
host = ""
else:
host = os.uname()[1]

View File

@ -42,7 +42,7 @@ LOG = logging.getLogger(".gen.utils.file")
# Gramps modules
#
#-------------------------------------------------------------------------
from ..constfunc import win, mac, cuni, conv_to_unicode, UNITYPE
from ..constfunc import win, mac, cuni, conv_to_unicode, UNITYPE, get_env_var
from ..const import TEMP_DIR, USER_HOME, GRAMPS_LOCALE as glocale
#-------------------------------------------------------------------------
@ -258,14 +258,14 @@ def search_for(name):
else:
name = name.split()[0]
if win():
for i in os.environ['PATH'].split(';'):
for i in get_env_var('PATH').split(';'):
fname = os.path.join(i, name)
if os.access(fname, os.X_OK) and not os.path.isdir(fname):
return 1
if os.access(name, os.X_OK) and not os.path.isdir(name):
return 1
else:
for i in os.environ['PATH'].split(':'):
for i in os.environ['PATH'].split(':'): #not win()
fname = os.path.join(i, name)
if os.access(fname, os.X_OK) and not os.path.isdir(fname):
return 1