Fix write_lock_file exception when USERNAME is missing (#1171)
Fixes #12150
This commit is contained in:
parent
d173809d8c
commit
226e8c549a
@ -42,6 +42,8 @@ from ..const import PLUGINS_DIR, USER_PLUGINS
|
|||||||
from ..constfunc import win, get_env_var
|
from ..constfunc import win, get_env_var
|
||||||
from ..config import config
|
from ..config import config
|
||||||
from .dbconst import DBLOGNAME, DBLOCKFN, DBBACKEND
|
from .dbconst import DBLOGNAME, DBLOCKFN, DBBACKEND
|
||||||
|
from ..const import GRAMPS_LOCALE as glocale
|
||||||
|
_ = glocale.translation.gettext
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -211,8 +213,8 @@ def write_lock_file(name):
|
|||||||
if win():
|
if win():
|
||||||
user = get_env_var('USERNAME')
|
user = get_env_var('USERNAME')
|
||||||
host = get_env_var('USERDOMAIN')
|
host = get_env_var('USERDOMAIN')
|
||||||
if host is None:
|
if not user:
|
||||||
host = ""
|
user = _("Unknown")
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user