Consistent use of OS detection and host added to Win users.
svn: r15931
This commit is contained in:
parent
3fb1e0fd4a
commit
c414e34ceb
@ -58,6 +58,7 @@ from gen.db.dbconst import *
|
|||||||
from gen.utils.callback import Callback
|
from gen.utils.callback import Callback
|
||||||
from gen.updatecallback import UpdateCallback
|
from gen.updatecallback import UpdateCallback
|
||||||
import Errors
|
import Errors
|
||||||
|
import constfunc
|
||||||
|
|
||||||
_LOG = logging.getLogger(DBLOGNAME)
|
_LOG = logging.getLogger(DBLOGNAME)
|
||||||
_MINVERSION = 9
|
_MINVERSION = 9
|
||||||
@ -1751,8 +1752,12 @@ def write_lock_file(name):
|
|||||||
if not os.path.isdir(name):
|
if not os.path.isdir(name):
|
||||||
os.mkdir(name)
|
os.mkdir(name)
|
||||||
f = open(os.path.join(name, DBLOCKFN), "w")
|
f = open(os.path.join(name, DBLOCKFN), "w")
|
||||||
if os.name == 'nt':
|
if constfunc.win():
|
||||||
text = os.environ['USERNAME']
|
user = os.environ['USERNAME']
|
||||||
|
try:
|
||||||
|
host = os.environ['USERDOMAIN']
|
||||||
|
except:
|
||||||
|
host = ""
|
||||||
else:
|
else:
|
||||||
host = os.uname()[1]
|
host = os.uname()[1]
|
||||||
# An ugly workaround for os.getlogin() issue with Konsole
|
# An ugly workaround for os.getlogin() issue with Konsole
|
||||||
@ -1760,7 +1765,10 @@ def write_lock_file(name):
|
|||||||
user = os.getlogin()
|
user = os.getlogin()
|
||||||
except:
|
except:
|
||||||
user = os.environ.get('USER')
|
user = os.environ.get('USER')
|
||||||
|
if host:
|
||||||
text = "%s@%s" % (user, host)
|
text = "%s@%s" % (user, host)
|
||||||
|
else:
|
||||||
|
text = user
|
||||||
# Save only the username and host, so the massage can be
|
# Save only the username and host, so the massage can be
|
||||||
# printed with correct locale in DbManager.py when a lock is found
|
# printed with correct locale in DbManager.py when a lock is found
|
||||||
f.write(text)
|
f.write(text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user