Create session folder only if the session is actually created successfully (authorized)

This commit is contained in:
Manuel Cortez 2022-11-17 16:18:30 -06:00
parent 3ad01d1ab0
commit 2ab61ebee6
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790

View File

@ -6,10 +6,12 @@ import output
import time
import sound
import logging
import config
import config_utils
import sqlitedict
import application
from . import session_exceptions as Exceptions
log = logging.getLogger("sessionmanager.session")
class baseSession(object):
@ -52,6 +54,13 @@ class baseSession(object):
def is_logged(self):
return self.logged
def create_session_folder(self):
path = os.path.join(paths.config_path(), self.session_id)
if not os.path.exists(path):
log.debug("Creating %s path" % (os.path.join(paths.config_path(), path),))
os.mkdir(path)
config.app["sessions"]["sessions"].append(id)
def get_configuration(self):
""" Get settings for a session."""
file_ = "%s/session.conf" % (self.session_id,)
@ -63,7 +72,6 @@ class baseSession(object):
def get_name(self):
pass
def init_sound(self):
try: self.sound = sound.soundSystem(self.settings["sound"])
except: pass