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

This commit is contained in:
John Ralls 2014-03-27 11:32:37 -07:00
parent 2a81c76e69
commit 71650917bf
4 changed files with 9 additions and 10 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

@ -2464,10 +2464,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

@ -44,7 +44,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
#-------------------------------------------------------------------------
@ -266,14 +266,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(':'):
else:
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

View File

@ -24,7 +24,7 @@
# Need to be able to import Gramps files from here.
import os
if os.environ.get('GRAMPS_RESOURCES', None) is None:
if not 'GRAMPS_RESOURCES' in os.environ:
os.environ['GRAMPS_RESOURCES'] = os.path.dirname(os.path.abspath("../.."))
from gramps.gen.const import DATA_DIR, WEB_DIR