mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-07-21 07:16:07 -04:00
Made code indentation to comply with PEP8
This commit is contained in:
@@ -11,41 +11,41 @@ from sessions import session_exceptions
|
||||
|
||||
manager = None
|
||||
def setup():
|
||||
global manager
|
||||
if not manager:
|
||||
manager = sessionManager()
|
||||
global manager
|
||||
if not manager:
|
||||
manager = sessionManager()
|
||||
|
||||
class sessionManager(object):
|
||||
# def __init__(self):
|
||||
# FILE = "sessions.conf"
|
||||
# SPEC = "app-configuration.defaults"
|
||||
# try:
|
||||
# self.main = Configuration(paths.config_path(FILE), paths.app_path(SPEC))
|
||||
# except ConfigurationResetException:
|
||||
# pass
|
||||
# def __init__(self):
|
||||
# FILE = "sessions.conf"
|
||||
# SPEC = "app-configuration.defaults"
|
||||
# try:
|
||||
# self.main = Configuration(paths.config_path(FILE), paths.app_path(SPEC))
|
||||
# except ConfigurationResetException:
|
||||
# pass
|
||||
|
||||
def get_current_session(self):
|
||||
if self.is_valid(config.app["sessions"]["current_session"]):
|
||||
return config.app["sessions"]["current_session"]
|
||||
else:
|
||||
return False
|
||||
def get_current_session(self):
|
||||
if self.is_valid(config.app["sessions"]["current_session"]):
|
||||
return config.app["sessions"]["current_session"]
|
||||
else:
|
||||
return False
|
||||
|
||||
def add_session(self, id):
|
||||
log.debug("Adding a new session: %s" % (id,))
|
||||
path = os.path.join(paths.config_path(), 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 add_session(self, id):
|
||||
log.debug("Adding a new session: %s" % (id,))
|
||||
path = os.path.join(paths.config_path(), 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 set_current_session(self, sessionID):
|
||||
config.app["sessions"]["current_session"] = sessionID
|
||||
config.app.write()
|
||||
def set_current_session(self, sessionID):
|
||||
config.app["sessions"]["current_session"] = sessionID
|
||||
config.app.write()
|
||||
|
||||
def is_valid(self, id):
|
||||
if not os.path.exists(os.path.join(paths.config_path(), id)):
|
||||
raise session_exceptions.NonExistentSessionError("That session does not exist.")
|
||||
config.app["sessions"]["current_session"] = ""
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
def is_valid(self, id):
|
||||
if not os.path.exists(os.path.join(paths.config_path(), id)):
|
||||
raise session_exceptions.NonExistentSessionError("That session does not exist.")
|
||||
config.app["sessions"]["current_session"] = ""
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
Reference in New Issue
Block a user