Add two env vars to set nick name and user dir
This commit is contained in:
parent
d213eada76
commit
a32007ec7a
@ -6,8 +6,17 @@ except ImportError:
|
|||||||
from sugar.__installed__ import *
|
from sugar.__installed__ import *
|
||||||
|
|
||||||
def get_user_dir():
|
def get_user_dir():
|
||||||
|
if os.environ.has_key('SUGAR_USER_DIR'):
|
||||||
|
return os.environ['SUGAR_USER_DIR']
|
||||||
|
else:
|
||||||
return os.path.expanduser('~/.sugar/')
|
return os.path.expanduser('~/.sugar/')
|
||||||
|
|
||||||
|
def get_nick_name():
|
||||||
|
if os.environ.has_key('SUGAR_NICK_NAME'):
|
||||||
|
return os.environ['SUGAR_NICK_NAME']
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def get_data_file(filename):
|
def get_data_file(filename):
|
||||||
for data_dir in get_data_dirs():
|
for data_dir in get_data_dirs():
|
||||||
path = os.path.join(data_dir, filename)
|
path = os.path.join(data_dir, filename)
|
||||||
|
@ -83,6 +83,8 @@ class Owner(Buddy):
|
|||||||
def __init__(self, group):
|
def __init__(self, group):
|
||||||
self._group = group
|
self._group = group
|
||||||
|
|
||||||
|
nick = env.get_nick_name()
|
||||||
|
if not nick:
|
||||||
nick = pwd.getpwuid(os.getuid())[0]
|
nick = pwd.getpwuid(os.getuid())[0]
|
||||||
if not nick or not len(nick):
|
if not nick or not len(nick):
|
||||||
nick = "n00b"
|
nick = "n00b"
|
||||||
|
Loading…
Reference in New Issue
Block a user