added mkdir flag to Session.__init__() to allow adopting existing sessions

(Boeing r1786)
This commit is contained in:
ahrenholz 2013-10-25 15:21:08 +00:00
parent 0fc51e38bf
commit d00a49d682

View file

@ -45,7 +45,7 @@ class Session(object):
''' CORE session manager. ''' CORE session manager.
''' '''
def __init__(self, sessionid = None, cfg = {}, server = None, def __init__(self, sessionid = None, cfg = {}, server = None,
persistent = False): persistent = False, mkdir = True):
if sessionid is None: if sessionid is None:
# try to keep this short since it's used to construct # try to keep this short since it's used to construct
# network interface names # network interface names
@ -57,7 +57,8 @@ class Session(object):
self.sessionid = sessionid self.sessionid = sessionid
self.sessiondir = os.path.join(tempfile.gettempdir(), self.sessiondir = os.path.join(tempfile.gettempdir(),
"pycore.%s" % self.sessionid) "pycore.%s" % self.sessionid)
os.mkdir(self.sessiondir) if mkdir:
os.mkdir(self.sessiondir)
self.name = None self.name = None
self.filename = None self.filename = None
self.thumbnail = None self.thumbnail = None