Commit a6456f56 authored by Valentin Valls's avatar Valentin Valls
Browse files

Use a shared default session name instead of an hardcoded one

parent d9c34678
......@@ -25,6 +25,7 @@ from bliss.config.conductor.client import get_text_file, get_python_modules, get
from bliss.common.proxy import Proxy
from bliss.common.logtools import log_warning
from bliss.common.utils import UserNamespace
from bliss.common import constants
from bliss.scanning import scan_saving
from bliss.scanning import scan_display
......@@ -841,7 +842,7 @@ class DefaultSession(Session):
"""
def __init__(self):
Session.__init__(self, "__DEFAULT__", {"config-objects": []})
Session.__init__(self, constants.DEFAULT_SESSION_NAME, {"config-objects": []})
def _set_scan_saving(self, cls=None):
if cls is not None:
......
......@@ -44,6 +44,7 @@ from bliss.config import get_sessions_list
from bliss.config import static
from bliss.config.static import ConfigNode
from bliss.config.conductor import client
from bliss.common import constants
from bliss import logging_startup
from bliss import current_session, global_map
......@@ -252,9 +253,7 @@ def main():
else:
if session_name is None:
session = (
"__DEFAULT__"
) # see __DEFAULT__ in bliss.shell.cli.repl => def cli()
session = constants.DEFAULT_SESSION_NAME
else:
session = session_name
......
......@@ -47,6 +47,7 @@ from bliss.shell.cli.typing_helper import TypingHelper
from bliss.shell.cli.ptpython_statusbar_patch import NEWstatus_bar, TMUXstatus_bar
from bliss.common.utils import ShellStr
from bliss.common import constants
from bliss import release, current_session
from bliss.config import static
from bliss.shell.standard import info
......@@ -716,7 +717,7 @@ def cli(
user_ns["protect"] = protected_user_ns.protect
user_ns["unprotect"] = protected_user_ns.unprotect
if session_name and not session_name.startswith("__DEFAULT__"):
if session_name and not session_name.startswith(constants.DEFAULT_SESSION_NAME):
try:
session = initialize(session_name, session_env=user_ns)
except RuntimeError as e:
......@@ -727,7 +728,7 @@ def cli(
else:
session = initialize(session_name=None, session_env=user_ns)
if session.name != "__DEFAULT__":
if session.name != constants.DEFAULT_SESSION_NAME:
protected_user_ns.protect(session.object_names)
# protect Aliases if they exist
if "ALIASES" in protected_user_ns:
......@@ -755,7 +756,7 @@ def cli(
def get_globals():
return protected_user_ns
if session_name and not session_name.startswith("__DEFAULT__"):
if session_name and not session_name.startswith(constants.DEFAULT_SESSION_NAME):
session_id = session_name
session_title = "Bliss shell ({0})".format(session_name)
prompt_label = session_name.upper()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment